From: gotty Date: Fri, 22 Nov 2019 04:33:27 +0000 (+0000) Subject: [LIB-10] SerialVersionUID for Serializable classes X-Git-Url: https://git.hedgecode.org/?a=commitdiff_plain;h=2730133cd1f5b0f4d26b042c1171155797636929;p=snooker-score-api.git [LIB-10] SerialVersionUID for Serializable classes git-svn-id: https://svn.hedgecode.org/lib/snooker-score-api/trunk@190 fb0bcced-7025-49ed-a12f-f98bce993226 --- diff --git a/src/main/java/org/hedgecode/snooker/api/Season.java b/src/main/java/org/hedgecode/snooker/api/Season.java index e206d8b..14c5364 100644 --- a/src/main/java/org/hedgecode/snooker/api/Season.java +++ b/src/main/java/org/hedgecode/snooker/api/Season.java @@ -28,6 +28,8 @@ import java.util.Map; */ public class Season implements Serializable { + private static final long serialVersionUID = -4233073149675278053L; + private static final Calendar CURRENT_CALENDAR = Calendar.getInstance(); private static final int NEW_SEASON_MONTH = 5; /* June */ diff --git a/src/main/java/org/hedgecode/snooker/api/SnookerURL.java b/src/main/java/org/hedgecode/snooker/api/SnookerURL.java index db14607..ceff340 100644 --- a/src/main/java/org/hedgecode/snooker/api/SnookerURL.java +++ b/src/main/java/org/hedgecode/snooker/api/SnookerURL.java @@ -26,6 +26,8 @@ import java.net.URL; */ public class SnookerURL implements Serializable { + private static final long serialVersionUID = 5068013909126568563L; + private String name; private URL url; diff --git a/src/main/java/org/hedgecode/snooker/compare/EventComparators.java b/src/main/java/org/hedgecode/snooker/compare/EventComparators.java index 3e2577f..63db086 100644 --- a/src/main/java/org/hedgecode/snooker/compare/EventComparators.java +++ b/src/main/java/org/hedgecode/snooker/compare/EventComparators.java @@ -16,7 +16,6 @@ package org.hedgecode.snooker.compare; -import java.io.Serializable; import java.util.Comparator; import org.hedgecode.snooker.api.Event; @@ -43,7 +42,7 @@ public enum EventComparators { return comparator; } - static class DateComparator implements Comparator, Serializable { + static class DateComparator implements Comparator { @Override public int compare(Event event1, Event event2) { @@ -52,7 +51,7 @@ public enum EventComparators { } - static class SnookerIdComparator implements Comparator, Serializable { + static class SnookerIdComparator implements Comparator { @Override public int compare(Event event1, Event event2) { diff --git a/src/main/java/org/hedgecode/snooker/compare/MatchComparators.java b/src/main/java/org/hedgecode/snooker/compare/MatchComparators.java index b7439ac..6138f84 100644 --- a/src/main/java/org/hedgecode/snooker/compare/MatchComparators.java +++ b/src/main/java/org/hedgecode/snooker/compare/MatchComparators.java @@ -16,7 +16,6 @@ package org.hedgecode.snooker.compare; -import java.io.Serializable; import java.util.Comparator; import org.hedgecode.snooker.api.Match; @@ -43,7 +42,7 @@ public enum MatchComparators { return comparator; } - static class RoundNumberComparator implements Comparator, Serializable { + static class RoundNumberComparator implements Comparator { @Override public int compare(Match match1, Match match2) { @@ -54,7 +53,7 @@ public enum MatchComparators { } - static class EventComparator implements Comparator, Serializable { + static class EventComparator implements Comparator { @Override public int compare(Match match1, Match match2) { diff --git a/src/main/java/org/hedgecode/snooker/compare/PlayerComparators.java b/src/main/java/org/hedgecode/snooker/compare/PlayerComparators.java index f389c9c..fc18aba 100644 --- a/src/main/java/org/hedgecode/snooker/compare/PlayerComparators.java +++ b/src/main/java/org/hedgecode/snooker/compare/PlayerComparators.java @@ -16,7 +16,6 @@ package org.hedgecode.snooker.compare; -import java.io.Serializable; import java.util.Comparator; import org.hedgecode.snooker.api.Player; @@ -43,7 +42,7 @@ public enum PlayerComparators { return comparator; } - static class NameComparator implements Comparator, Serializable { + static class NameComparator implements Comparator { @Override public int compare(Player player1, Player player2) { @@ -52,7 +51,7 @@ public enum PlayerComparators { } - static class AgeComparator implements Comparator, Serializable { + static class AgeComparator implements Comparator { @Override public int compare(Player player1, Player player2) { diff --git a/src/main/java/org/hedgecode/snooker/compare/RankingComparators.java b/src/main/java/org/hedgecode/snooker/compare/RankingComparators.java index 2d1bb56..3cac7a3 100644 --- a/src/main/java/org/hedgecode/snooker/compare/RankingComparators.java +++ b/src/main/java/org/hedgecode/snooker/compare/RankingComparators.java @@ -16,7 +16,6 @@ package org.hedgecode.snooker.compare; -import java.io.Serializable; import java.util.Comparator; import org.hedgecode.snooker.api.Ranking; @@ -43,7 +42,7 @@ public enum RankingComparators { return comparator; } - static class PositionComparator implements Comparator, Serializable { + static class PositionComparator implements Comparator { @Override public int compare(Ranking ranking1, Ranking ranking2) { @@ -52,7 +51,7 @@ public enum RankingComparators { } - static class SumComparator implements Comparator, Serializable { + static class SumComparator implements Comparator { @Override public int compare(Ranking ranking1, Ranking ranking2) { diff --git a/src/main/java/org/hedgecode/snooker/compare/RoundComparators.java b/src/main/java/org/hedgecode/snooker/compare/RoundComparators.java index 12226a9..1508ee3 100644 --- a/src/main/java/org/hedgecode/snooker/compare/RoundComparators.java +++ b/src/main/java/org/hedgecode/snooker/compare/RoundComparators.java @@ -16,7 +16,6 @@ package org.hedgecode.snooker.compare; -import java.io.Serializable; import java.util.Comparator; import org.hedgecode.snooker.api.Round; @@ -43,7 +42,7 @@ public enum RoundComparators { return comparator; } - static class RoundComparator implements Comparator, Serializable { + static class RoundComparator implements Comparator { @Override public int compare(Round round1, Round round2) { @@ -52,7 +51,7 @@ public enum RoundComparators { } - static class EventComparator implements Comparator, Serializable { + static class EventComparator implements Comparator { @Override public int compare(Round round1, Round round2) { diff --git a/src/main/java/org/hedgecode/snooker/compare/SeedingComparators.java b/src/main/java/org/hedgecode/snooker/compare/SeedingComparators.java index fa7c562..842039b 100644 --- a/src/main/java/org/hedgecode/snooker/compare/SeedingComparators.java +++ b/src/main/java/org/hedgecode/snooker/compare/SeedingComparators.java @@ -16,7 +16,6 @@ package org.hedgecode.snooker.compare; -import java.io.Serializable; import java.util.Comparator; import org.hedgecode.snooker.api.Seeding; @@ -45,7 +44,7 @@ public enum SeedingComparators { return comparator; } - static class EventComparator implements Comparator, Serializable { + static class EventComparator implements Comparator { @Override public int compare(Seeding seeding1, Seeding seeding2) { @@ -54,7 +53,7 @@ public enum SeedingComparators { } - static class PlayerComparator implements Comparator, Serializable { + static class PlayerComparator implements Comparator { @Override public int compare(Seeding seeding1, Seeding seeding2) { @@ -63,7 +62,7 @@ public enum SeedingComparators { } - static class SeedingComparator implements Comparator, Serializable { + static class SeedingComparator implements Comparator { @Override public int compare(Seeding seeding1, Seeding seeding2) { diff --git a/src/main/java/org/hedgecode/snooker/json/JsonCollectionEntity.java b/src/main/java/org/hedgecode/snooker/json/JsonCollectionEntity.java index 69c9f13..11f300d 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonCollectionEntity.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonCollectionEntity.java @@ -36,9 +36,11 @@ import org.hedgecode.snooker.api.IdEntity; public abstract class JsonCollectionEntity implements CollectionEntity, Serializable { + private static final long serialVersionUID = 6302642716627217361L; + private final Map entities = new LinkedHashMap<>(); - protected JsonCollectionEntity(E[] entities) { + JsonCollectionEntity(E[] entities) { for (E entity : entities) { if (entity != null) this.entities.put( @@ -47,7 +49,7 @@ public abstract class JsonCollectionEntity } } - protected JsonCollectionEntity(List entities) { + JsonCollectionEntity(List entities) { for (E entity : entities) { this.entities.put( entity.getId(), entity diff --git a/src/main/java/org/hedgecode/snooker/json/JsonEvent.java b/src/main/java/org/hedgecode/snooker/json/JsonEvent.java index 9b1eece..526389f 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonEvent.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonEvent.java @@ -16,6 +16,7 @@ package org.hedgecode.snooker.json; +import java.io.Serializable; import java.util.Date; import com.google.gson.annotations.Expose; @@ -34,7 +35,9 @@ import org.hedgecode.snooker.api.Season; * * @author Dmitry Samoshin aka gotty */ -public class JsonEvent extends JsonIdEntity implements Event { +public class JsonEvent extends JsonIdEntity implements Event, Serializable { + + private static final long serialVersionUID = 3074418501643772690L; @SerializedName("ID") private int eventId; @@ -127,7 +130,7 @@ public class JsonEvent extends JsonIdEntity implements Event { @Expose private Event previousEdition; - protected JsonEvent() { + JsonEvent() { } @Override diff --git a/src/main/java/org/hedgecode/snooker/json/JsonEvents.java b/src/main/java/org/hedgecode/snooker/json/JsonEvents.java index 4a7aec7..d536507 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonEvents.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonEvents.java @@ -16,6 +16,7 @@ package org.hedgecode.snooker.json; +import java.io.Serializable; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; @@ -31,15 +32,17 @@ import org.hedgecode.snooker.compare.EventComparators; * * @author Dmitry Samoshin aka gotty */ -public class JsonEvents extends JsonCollectionEntity implements Events { +public class JsonEvents extends JsonCollectionEntity implements Events, Serializable { + + private static final long serialVersionUID = 3333612126168481839L; private static final JsonEvents EMPTY = new JsonEvents(new Event[0]); - protected JsonEvents(Event[] entities) { + JsonEvents(Event[] entities) { super(entities); } - protected JsonEvents(List entities) { + JsonEvents(List entities) { super(entities); } diff --git a/src/main/java/org/hedgecode/snooker/json/JsonIdEntity.java b/src/main/java/org/hedgecode/snooker/json/JsonIdEntity.java index 4ee0c88..ec84274 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonIdEntity.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonIdEntity.java @@ -16,8 +16,6 @@ package org.hedgecode.snooker.json; -import java.io.Serializable; - import org.hedgecode.snooker.api.IdEntity; /** @@ -25,10 +23,8 @@ import org.hedgecode.snooker.api.IdEntity; * * @author Dmitry Samoshin aka gotty */ -public abstract class JsonIdEntity - extends JsonURLEntity - implements IdEntity, Serializable -{ +public abstract class JsonIdEntity extends JsonURLEntity implements IdEntity { + @Override public boolean equals(Object obj) { if (this == obj) @@ -43,9 +39,8 @@ public abstract class JsonIdEntity @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + getId(); + int result = getClass().getSimpleName().hashCode(); + result = 31 * result + getId(); return result; } diff --git a/src/main/java/org/hedgecode/snooker/json/JsonMatch.java b/src/main/java/org/hedgecode/snooker/json/JsonMatch.java index f593735..3a2ad3d 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonMatch.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonMatch.java @@ -16,6 +16,7 @@ package org.hedgecode.snooker.json; +import java.io.Serializable; import java.util.Date; import com.google.gson.annotations.Expose; @@ -32,7 +33,9 @@ import org.hedgecode.snooker.api.Player; * * @author Dmitry Samoshin aka gotty */ -public class JsonMatch extends JsonIdEntity implements Match { +public class JsonMatch extends JsonIdEntity implements Match, Serializable { + + private static final long serialVersionUID = 1503003854433798119L; @SerializedName("ID") private int matchId; @@ -112,7 +115,7 @@ public class JsonMatch extends JsonIdEntity implements Match { @SerializedName("ExtendedNote") private String extendedNote; - protected JsonMatch() { + JsonMatch() { } @Override diff --git a/src/main/java/org/hedgecode/snooker/json/JsonMatches.java b/src/main/java/org/hedgecode/snooker/json/JsonMatches.java index fa99374..70698da 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonMatches.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonMatches.java @@ -16,6 +16,7 @@ package org.hedgecode.snooker.json; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -28,15 +29,17 @@ import org.hedgecode.snooker.compare.MatchComparators; * * @author Dmitry Samoshin aka gotty */ -public class JsonMatches extends JsonCollectionEntity implements Matches { +public class JsonMatches extends JsonCollectionEntity implements Matches, Serializable { + + private static final long serialVersionUID = 7399435317464241002L; private static final JsonMatches EMPTY = new JsonMatches(new Match[0]); - protected JsonMatches(Match[] entities) { + JsonMatches(Match[] entities) { super(entities); } - protected JsonMatches(List entities) { + JsonMatches(List entities) { super(entities); } diff --git a/src/main/java/org/hedgecode/snooker/json/JsonOngoingMatch.java b/src/main/java/org/hedgecode/snooker/json/JsonOngoingMatch.java index 33530c2..1bbb18c 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonOngoingMatch.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonOngoingMatch.java @@ -16,6 +16,8 @@ package org.hedgecode.snooker.json; +import java.io.Serializable; + import org.hedgecode.snooker.api.OngoingMatch; /** @@ -23,9 +25,11 @@ import org.hedgecode.snooker.api.OngoingMatch; * * @author Dmitry Samoshin aka gotty */ -public class JsonOngoingMatch extends JsonMatch implements OngoingMatch { +public class JsonOngoingMatch extends JsonMatch implements OngoingMatch, Serializable { + + private static final long serialVersionUID = -6395358544537389727L; - protected JsonOngoingMatch() { + JsonOngoingMatch() { } } diff --git a/src/main/java/org/hedgecode/snooker/json/JsonOngoingMatches.java b/src/main/java/org/hedgecode/snooker/json/JsonOngoingMatches.java index 427ebfd..3d939d6 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonOngoingMatches.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonOngoingMatches.java @@ -16,6 +16,8 @@ package org.hedgecode.snooker.json; +import java.io.Serializable; + import org.hedgecode.snooker.api.OngoingMatch; import org.hedgecode.snooker.api.OngoingMatches; @@ -25,9 +27,12 @@ import org.hedgecode.snooker.api.OngoingMatches; * @author Dmitry Samoshin aka gotty */ public class JsonOngoingMatches - extends JsonCollectionEntity implements OngoingMatches + extends JsonCollectionEntity + implements OngoingMatches, Serializable { - protected JsonOngoingMatches(OngoingMatch[] entities) { + private static final long serialVersionUID = 1026260972671849624L; + + JsonOngoingMatches(OngoingMatch[] entities) { super(entities); } diff --git a/src/main/java/org/hedgecode/snooker/json/JsonPlayer.java b/src/main/java/org/hedgecode/snooker/json/JsonPlayer.java index 43be4fd..51a6e89 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonPlayer.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonPlayer.java @@ -16,6 +16,7 @@ package org.hedgecode.snooker.json; +import java.io.Serializable; import java.net.URL; import java.util.Date; @@ -33,7 +34,9 @@ import org.hedgecode.snooker.api.PlayerImage; * * @author Dmitry Samoshin aka gotty */ -public class JsonPlayer extends JsonIdEntity implements Player { +public class JsonPlayer extends JsonIdEntity implements Player, Serializable { + + private static final long serialVersionUID = 5978347071162091429L; @SerializedName("ID") private int playerId; @@ -90,7 +93,7 @@ public class JsonPlayer extends JsonIdEntity implements Player { @SerializedName("Info") private String info; - protected JsonPlayer() { + JsonPlayer() { } @Override diff --git a/src/main/java/org/hedgecode/snooker/json/JsonPlayers.java b/src/main/java/org/hedgecode/snooker/json/JsonPlayers.java index 8503521..2c4e65f 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonPlayers.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonPlayers.java @@ -16,6 +16,7 @@ package org.hedgecode.snooker.json; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -28,15 +29,17 @@ import org.hedgecode.snooker.compare.PlayerComparators; * * @author Dmitry Samoshin aka gotty */ -public class JsonPlayers extends JsonCollectionEntity implements Players { +public class JsonPlayers extends JsonCollectionEntity implements Players, Serializable { + + private static final long serialVersionUID = 7472642207778686468L; private static final JsonPlayers EMPTY = new JsonPlayers(new Player[0]); - protected JsonPlayers(Player[] entities) { + JsonPlayers(Player[] entities) { super(entities); } - protected JsonPlayers(List entities) { + JsonPlayers(List entities) { super(entities); } diff --git a/src/main/java/org/hedgecode/snooker/json/JsonRanking.java b/src/main/java/org/hedgecode/snooker/json/JsonRanking.java index 572d599..6be0124 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonRanking.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonRanking.java @@ -16,6 +16,8 @@ package org.hedgecode.snooker.json; +import java.io.Serializable; + import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; @@ -29,7 +31,9 @@ import org.hedgecode.snooker.api.Season; * * @author Dmitry Samoshin aka gotty */ -public class JsonRanking extends JsonIdEntity implements Ranking { +public class JsonRanking extends JsonIdEntity implements Ranking, Serializable { + + private static final long serialVersionUID = -8009582917499815478L; @SerializedName("ID") private int rankingId; @@ -50,7 +54,7 @@ public class JsonRanking extends JsonIdEntity implements Ranking { @Expose private RankingType rankingType; - protected JsonRanking() { + JsonRanking() { } @Override diff --git a/src/main/java/org/hedgecode/snooker/json/JsonRankings.java b/src/main/java/org/hedgecode/snooker/json/JsonRankings.java index 0cb9d54..d00a814 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonRankings.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonRankings.java @@ -16,6 +16,7 @@ package org.hedgecode.snooker.json; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -28,15 +29,17 @@ import org.hedgecode.snooker.compare.RankingComparators; * * @author Dmitry Samoshin aka gotty */ -public class JsonRankings extends JsonCollectionEntity implements Rankings { +public class JsonRankings extends JsonCollectionEntity implements Rankings, Serializable { + + private static final long serialVersionUID = -1765390719034378729L; private static final JsonRankings EMPTY = new JsonRankings(new Ranking[0]); - protected JsonRankings(Ranking[] entities) { + JsonRankings(Ranking[] entities) { super(entities); } - protected JsonRankings(List entities) { + JsonRankings(List entities) { super(entities); } diff --git a/src/main/java/org/hedgecode/snooker/json/JsonRound.java b/src/main/java/org/hedgecode/snooker/json/JsonRound.java index 89921ec..2737cac 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonRound.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonRound.java @@ -16,6 +16,8 @@ package org.hedgecode.snooker.json; +import java.io.Serializable; + import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; @@ -28,7 +30,9 @@ import org.hedgecode.snooker.api.Round; * * @author Dmitry Samoshin aka gotty */ -public class JsonRound extends JsonIdEntity implements Round { +public class JsonRound extends JsonIdEntity implements Round, Serializable { + + private static final long serialVersionUID = -2010008975829800984L; @SerializedName("Round") private int round; @@ -70,7 +74,7 @@ public class JsonRound extends JsonIdEntity implements Round { @SerializedName("SeedPoints") private int seedPoints; - protected JsonRound() { + JsonRound() { } @Override diff --git a/src/main/java/org/hedgecode/snooker/json/JsonRounds.java b/src/main/java/org/hedgecode/snooker/json/JsonRounds.java index 11a75e7..44e5b9d 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonRounds.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonRounds.java @@ -16,6 +16,7 @@ package org.hedgecode.snooker.json; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -28,15 +29,17 @@ import org.hedgecode.snooker.compare.RoundComparators; * * @author Dmitry Samoshin aka gotty */ -public class JsonRounds extends JsonCollectionEntity implements Rounds { +public class JsonRounds extends JsonCollectionEntity implements Rounds, Serializable { + + private static final long serialVersionUID = -292582814222405882L; private static final JsonRounds EMPTY = new JsonRounds(new Round[0]); - protected JsonRounds(Round[] entities) { + JsonRounds(Round[] entities) { super(entities); } - protected JsonRounds(List entities) { + JsonRounds(List entities) { super(entities); } diff --git a/src/main/java/org/hedgecode/snooker/json/JsonSeeding.java b/src/main/java/org/hedgecode/snooker/json/JsonSeeding.java index 8b9f9ff..30dfd43 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonSeeding.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonSeeding.java @@ -16,6 +16,8 @@ package org.hedgecode.snooker.json; +import java.io.Serializable; + import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; @@ -28,7 +30,9 @@ import org.hedgecode.snooker.api.Seeding; * * @author Dmitry Samoshin aka gotty */ -public class JsonSeeding extends JsonIdEntity implements Seeding { +public class JsonSeeding extends JsonIdEntity implements Seeding, Serializable { + + private static final long serialVersionUID = -9182126924854384725L; @SerializedName("EventID") private int eventId; @@ -41,7 +45,7 @@ public class JsonSeeding extends JsonIdEntity implements Seeding { @SerializedName("Seeding") private int seeding; - protected JsonSeeding() { + JsonSeeding() { } @Override diff --git a/src/main/java/org/hedgecode/snooker/json/JsonSeedings.java b/src/main/java/org/hedgecode/snooker/json/JsonSeedings.java index 3b71237..6c3ef8c 100644 --- a/src/main/java/org/hedgecode/snooker/json/JsonSeedings.java +++ b/src/main/java/org/hedgecode/snooker/json/JsonSeedings.java @@ -16,6 +16,7 @@ package org.hedgecode.snooker.json; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -28,15 +29,17 @@ import org.hedgecode.snooker.compare.SeedingComparators; * * @author Dmitry Samoshin aka gotty */ -public class JsonSeedings extends JsonCollectionEntity implements Seedings { +public class JsonSeedings extends JsonCollectionEntity implements Seedings, Serializable { + + private static final long serialVersionUID = 8251290277292098461L; private static final JsonSeedings EMPTY = new JsonSeedings(new Seeding[0]); - protected JsonSeedings(Seeding[] entities) { + JsonSeedings(Seeding[] entities) { super(entities); } - protected JsonSeedings(List entities) { + JsonSeedings(List entities) { super(entities); } diff --git a/src/test/java/org/hedgecode/snooker/json/AbstractJsonTest.java b/src/test/java/org/hedgecode/snooker/json/AbstractJsonTest.java index cb8f2c7..d42fd4d 100644 --- a/src/test/java/org/hedgecode/snooker/json/AbstractJsonTest.java +++ b/src/test/java/org/hedgecode/snooker/json/AbstractJsonTest.java @@ -80,6 +80,12 @@ public abstract class AbstractJsonTest extends Assert { return sb.toString(); } + protected void verifySerialize(Serializable serializeObject) throws IOException { + if (!serializeFile.exists()) { + serialize(serializeObject); + } + } + protected void serialize(Serializable serializeObject) throws IOException { try (ObjectOutputStream oos = new ObjectOutputStream( diff --git a/src/test/java/org/hedgecode/snooker/json/JsonEventTest.java b/src/test/java/org/hedgecode/snooker/json/JsonEventTest.java index 1421a96..dd24814 100644 --- a/src/test/java/org/hedgecode/snooker/json/JsonEventTest.java +++ b/src/test/java/org/hedgecode/snooker/json/JsonEventTest.java @@ -36,7 +36,7 @@ public class JsonEventTest extends AbstractJsonTest { ), JsonEvent[].class ); - //serialize(jsonEvents[0]); + verifySerialize(jsonEvents[0]); JsonEvent expectedEvent = (JsonEvent) deserialize(); assertNull( expectedEvent, diff --git a/src/test/java/org/hedgecode/snooker/json/JsonEventsTest.java b/src/test/java/org/hedgecode/snooker/json/JsonEventsTest.java index c5fb327..5fe91eb 100644 --- a/src/test/java/org/hedgecode/snooker/json/JsonEventsTest.java +++ b/src/test/java/org/hedgecode/snooker/json/JsonEventsTest.java @@ -40,7 +40,7 @@ public class JsonEventsTest extends AbstractJsonTest { JsonEvent[].class ) ); - //serialize(actualEvents); + verifySerialize(actualEvents); JsonEvents expectedEvents = (JsonEvents) deserialize(); assertEquals( expectedEvents, diff --git a/src/test/java/org/hedgecode/snooker/json/JsonMatchTest.java b/src/test/java/org/hedgecode/snooker/json/JsonMatchTest.java index e9e31ea..0fd040e 100644 --- a/src/test/java/org/hedgecode/snooker/json/JsonMatchTest.java +++ b/src/test/java/org/hedgecode/snooker/json/JsonMatchTest.java @@ -36,7 +36,7 @@ public class JsonMatchTest extends AbstractJsonTest { ), JsonMatch[].class ); - //serialize(jsonMatches[0]); + verifySerialize(jsonMatches[0]); JsonMatch expectedMatch = (JsonMatch) deserialize(); assertNull( expectedMatch, diff --git a/src/test/java/org/hedgecode/snooker/json/JsonMatchesTest.java b/src/test/java/org/hedgecode/snooker/json/JsonMatchesTest.java index 7db2941..9a17f33 100644 --- a/src/test/java/org/hedgecode/snooker/json/JsonMatchesTest.java +++ b/src/test/java/org/hedgecode/snooker/json/JsonMatchesTest.java @@ -40,7 +40,7 @@ public class JsonMatchesTest extends AbstractJsonTest { JsonMatch[].class ) ); - //serialize(actualMatches); + verifySerialize(actualMatches); JsonMatches expectedMatches = (JsonMatches) deserialize(); assertEquals( expectedMatches, diff --git a/src/test/java/org/hedgecode/snooker/json/JsonOngoingMatchTest.java b/src/test/java/org/hedgecode/snooker/json/JsonOngoingMatchTest.java index c778cd8..8739b49 100644 --- a/src/test/java/org/hedgecode/snooker/json/JsonOngoingMatchTest.java +++ b/src/test/java/org/hedgecode/snooker/json/JsonOngoingMatchTest.java @@ -36,7 +36,7 @@ public class JsonOngoingMatchTest extends JsonMatchTest { ), JsonOngoingMatch[].class ); - //serialize(jsonOngoingMatches[0]); + verifySerialize(jsonOngoingMatches[0]); JsonOngoingMatch expectedOngoingMatch = (JsonOngoingMatch) deserialize(); assertNull( expectedOngoingMatch, diff --git a/src/test/java/org/hedgecode/snooker/json/JsonOngoingMatchesTest.java b/src/test/java/org/hedgecode/snooker/json/JsonOngoingMatchesTest.java index ee96b6c..870f654 100644 --- a/src/test/java/org/hedgecode/snooker/json/JsonOngoingMatchesTest.java +++ b/src/test/java/org/hedgecode/snooker/json/JsonOngoingMatchesTest.java @@ -40,7 +40,7 @@ public class JsonOngoingMatchesTest extends AbstractJsonTest { JsonOngoingMatch[].class ) ); - //serialize(actualOngoingMatches); + verifySerialize(actualOngoingMatches); JsonOngoingMatches expectedOngoingMatches = (JsonOngoingMatches) deserialize(); assertEquals( expectedOngoingMatches, diff --git a/src/test/java/org/hedgecode/snooker/json/JsonPlayerTest.java b/src/test/java/org/hedgecode/snooker/json/JsonPlayerTest.java index be885d1..654facd 100644 --- a/src/test/java/org/hedgecode/snooker/json/JsonPlayerTest.java +++ b/src/test/java/org/hedgecode/snooker/json/JsonPlayerTest.java @@ -36,7 +36,7 @@ public class JsonPlayerTest extends AbstractJsonTest { ), JsonPlayer[].class ); - //serialize(jsonPlayers[0]); + verifySerialize(jsonPlayers[0]); JsonPlayer expectedPlayer = (JsonPlayer) deserialize(); assertNull( expectedPlayer, diff --git a/src/test/java/org/hedgecode/snooker/json/JsonPlayersTest.java b/src/test/java/org/hedgecode/snooker/json/JsonPlayersTest.java index d0b7fc3..46e62d4 100644 --- a/src/test/java/org/hedgecode/snooker/json/JsonPlayersTest.java +++ b/src/test/java/org/hedgecode/snooker/json/JsonPlayersTest.java @@ -40,7 +40,7 @@ public class JsonPlayersTest extends AbstractJsonTest { JsonPlayer[].class ) ); - //serialize(actualPlayers); + verifySerialize(actualPlayers); JsonPlayers expectedPlayers = (JsonPlayers) deserialize(); assertEquals( expectedPlayers, diff --git a/src/test/java/org/hedgecode/snooker/json/JsonRankingTest.java b/src/test/java/org/hedgecode/snooker/json/JsonRankingTest.java index 63a3ef0..a6b8afe 100644 --- a/src/test/java/org/hedgecode/snooker/json/JsonRankingTest.java +++ b/src/test/java/org/hedgecode/snooker/json/JsonRankingTest.java @@ -36,7 +36,7 @@ public class JsonRankingTest extends AbstractJsonTest { ), JsonRanking[].class ); - //serialize(jsonRankings[0]); + verifySerialize(jsonRankings[0]); JsonRanking expectedRanking = (JsonRanking) deserialize(); assertNull( expectedRanking, diff --git a/src/test/java/org/hedgecode/snooker/json/JsonRankingsTest.java b/src/test/java/org/hedgecode/snooker/json/JsonRankingsTest.java index bcec928..fc0e7c7 100644 --- a/src/test/java/org/hedgecode/snooker/json/JsonRankingsTest.java +++ b/src/test/java/org/hedgecode/snooker/json/JsonRankingsTest.java @@ -40,7 +40,7 @@ public class JsonRankingsTest extends AbstractJsonTest { JsonRanking[].class ) ); - //serialize(actualRankings); + verifySerialize(actualRankings); JsonRankings expectedRankings = (JsonRankings) deserialize(); assertEquals( expectedRankings, diff --git a/src/test/java/org/hedgecode/snooker/json/JsonRoundTest.java b/src/test/java/org/hedgecode/snooker/json/JsonRoundTest.java index b3c4629..7dad5e8 100644 --- a/src/test/java/org/hedgecode/snooker/json/JsonRoundTest.java +++ b/src/test/java/org/hedgecode/snooker/json/JsonRoundTest.java @@ -36,7 +36,7 @@ public class JsonRoundTest extends AbstractJsonTest { ), JsonRound[].class ); - //serialize(jsonRounds[0]); + verifySerialize(jsonRounds[0]); JsonRound expectedRound = (JsonRound) deserialize(); assertNull( expectedRound, diff --git a/src/test/java/org/hedgecode/snooker/json/JsonRoundsTest.java b/src/test/java/org/hedgecode/snooker/json/JsonRoundsTest.java index cb06cea..27fef6f 100644 --- a/src/test/java/org/hedgecode/snooker/json/JsonRoundsTest.java +++ b/src/test/java/org/hedgecode/snooker/json/JsonRoundsTest.java @@ -40,7 +40,7 @@ public class JsonRoundsTest extends AbstractJsonTest { JsonRound[].class ) ); - //serialize(actualRounds); + verifySerialize(actualRounds); JsonRounds expectedRounds = (JsonRounds) deserialize(); assertEquals( expectedRounds, diff --git a/src/test/java/org/hedgecode/snooker/json/JsonSeedingTest.java b/src/test/java/org/hedgecode/snooker/json/JsonSeedingTest.java index 48d21fe..5140b71 100644 --- a/src/test/java/org/hedgecode/snooker/json/JsonSeedingTest.java +++ b/src/test/java/org/hedgecode/snooker/json/JsonSeedingTest.java @@ -36,7 +36,7 @@ public class JsonSeedingTest extends AbstractJsonTest { ), JsonSeeding[].class ); - //serialize(jsonSeedings[0]); + verifySerialize(jsonSeedings[0]); JsonSeeding expectedSeeding = (JsonSeeding) deserialize(); assertNull( expectedSeeding, diff --git a/src/test/java/org/hedgecode/snooker/json/JsonSeedingsTest.java b/src/test/java/org/hedgecode/snooker/json/JsonSeedingsTest.java index 5f20446..6a7ca1a 100644 --- a/src/test/java/org/hedgecode/snooker/json/JsonSeedingsTest.java +++ b/src/test/java/org/hedgecode/snooker/json/JsonSeedingsTest.java @@ -40,7 +40,7 @@ public class JsonSeedingsTest extends AbstractJsonTest { JsonSeeding[].class ) ); - //serialize(actualSeedings); + verifySerialize(actualSeedings); JsonSeedings expectedSeedings = (JsonSeedings) deserialize(); assertEquals( expectedSeedings, diff --git a/src/test/resources/org/hedgecode/snooker/json/JsonEventTest.ser b/src/test/resources/org/hedgecode/snooker/json/JsonEventTest.ser index 51976bd..ece4903 100644 Binary files a/src/test/resources/org/hedgecode/snooker/json/JsonEventTest.ser and b/src/test/resources/org/hedgecode/snooker/json/JsonEventTest.ser differ diff --git a/src/test/resources/org/hedgecode/snooker/json/JsonEventsTest.ser b/src/test/resources/org/hedgecode/snooker/json/JsonEventsTest.ser index 46c3604..fca110c 100644 Binary files a/src/test/resources/org/hedgecode/snooker/json/JsonEventsTest.ser and b/src/test/resources/org/hedgecode/snooker/json/JsonEventsTest.ser differ diff --git a/src/test/resources/org/hedgecode/snooker/json/JsonMatchTest.ser b/src/test/resources/org/hedgecode/snooker/json/JsonMatchTest.ser index b27434c..bc153e4 100644 Binary files a/src/test/resources/org/hedgecode/snooker/json/JsonMatchTest.ser and b/src/test/resources/org/hedgecode/snooker/json/JsonMatchTest.ser differ diff --git a/src/test/resources/org/hedgecode/snooker/json/JsonMatchesTest.ser b/src/test/resources/org/hedgecode/snooker/json/JsonMatchesTest.ser index 02d6906..653f0c3 100644 Binary files a/src/test/resources/org/hedgecode/snooker/json/JsonMatchesTest.ser and b/src/test/resources/org/hedgecode/snooker/json/JsonMatchesTest.ser differ diff --git a/src/test/resources/org/hedgecode/snooker/json/JsonOngoingMatchTest.ser b/src/test/resources/org/hedgecode/snooker/json/JsonOngoingMatchTest.ser index 71ee53e..96c0967 100644 Binary files a/src/test/resources/org/hedgecode/snooker/json/JsonOngoingMatchTest.ser and b/src/test/resources/org/hedgecode/snooker/json/JsonOngoingMatchTest.ser differ diff --git a/src/test/resources/org/hedgecode/snooker/json/JsonOngoingMatchesTest.ser b/src/test/resources/org/hedgecode/snooker/json/JsonOngoingMatchesTest.ser index 6094761..64637c0 100644 Binary files a/src/test/resources/org/hedgecode/snooker/json/JsonOngoingMatchesTest.ser and b/src/test/resources/org/hedgecode/snooker/json/JsonOngoingMatchesTest.ser differ diff --git a/src/test/resources/org/hedgecode/snooker/json/JsonPlayerTest.ser b/src/test/resources/org/hedgecode/snooker/json/JsonPlayerTest.ser index 55712f3..c50eb12 100644 Binary files a/src/test/resources/org/hedgecode/snooker/json/JsonPlayerTest.ser and b/src/test/resources/org/hedgecode/snooker/json/JsonPlayerTest.ser differ diff --git a/src/test/resources/org/hedgecode/snooker/json/JsonPlayersTest.ser b/src/test/resources/org/hedgecode/snooker/json/JsonPlayersTest.ser index a1d09f2..fbfea46 100644 Binary files a/src/test/resources/org/hedgecode/snooker/json/JsonPlayersTest.ser and b/src/test/resources/org/hedgecode/snooker/json/JsonPlayersTest.ser differ diff --git a/src/test/resources/org/hedgecode/snooker/json/JsonRankingTest.ser b/src/test/resources/org/hedgecode/snooker/json/JsonRankingTest.ser index e3ae79b..7675fc6 100644 Binary files a/src/test/resources/org/hedgecode/snooker/json/JsonRankingTest.ser and b/src/test/resources/org/hedgecode/snooker/json/JsonRankingTest.ser differ diff --git a/src/test/resources/org/hedgecode/snooker/json/JsonRankingsTest.ser b/src/test/resources/org/hedgecode/snooker/json/JsonRankingsTest.ser index 0417587..0abe854 100644 Binary files a/src/test/resources/org/hedgecode/snooker/json/JsonRankingsTest.ser and b/src/test/resources/org/hedgecode/snooker/json/JsonRankingsTest.ser differ diff --git a/src/test/resources/org/hedgecode/snooker/json/JsonRoundTest.ser b/src/test/resources/org/hedgecode/snooker/json/JsonRoundTest.ser index 5c9cbb3..9c69a01 100644 Binary files a/src/test/resources/org/hedgecode/snooker/json/JsonRoundTest.ser and b/src/test/resources/org/hedgecode/snooker/json/JsonRoundTest.ser differ diff --git a/src/test/resources/org/hedgecode/snooker/json/JsonRoundsTest.ser b/src/test/resources/org/hedgecode/snooker/json/JsonRoundsTest.ser index 1615f48..7e9d6ff 100644 Binary files a/src/test/resources/org/hedgecode/snooker/json/JsonRoundsTest.ser and b/src/test/resources/org/hedgecode/snooker/json/JsonRoundsTest.ser differ diff --git a/src/test/resources/org/hedgecode/snooker/json/JsonSeedingTest.ser b/src/test/resources/org/hedgecode/snooker/json/JsonSeedingTest.ser index 3643276..9eaf365 100644 Binary files a/src/test/resources/org/hedgecode/snooker/json/JsonSeedingTest.ser and b/src/test/resources/org/hedgecode/snooker/json/JsonSeedingTest.ser differ diff --git a/src/test/resources/org/hedgecode/snooker/json/JsonSeedingsTest.ser b/src/test/resources/org/hedgecode/snooker/json/JsonSeedingsTest.ser index cf56160..7b5e275 100644 Binary files a/src/test/resources/org/hedgecode/snooker/json/JsonSeedingsTest.ser and b/src/test/resources/org/hedgecode/snooker/json/JsonSeedingsTest.ser differ