From c11496ee81ceb8b465ef17b028a3cf7ed6567a8b Mon Sep 17 00:00:00 2001 From: gotty Date: Tue, 24 Jan 2017 23:21:06 +0000 Subject: [PATCH] [LIB-5] Change tests serialize git-svn-id: https://svn.hedgecode.org/lib/snooker-score-api/trunk@103 fb0bcced-7025-49ed-a12f-f98bce993226 --- .../java/org/hedgecode/snooker/api/SeasonTest.java | 2 +- .../org/hedgecode/snooker/json/AbstractJsonTest.java | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/test/java/org/hedgecode/snooker/api/SeasonTest.java b/src/test/java/org/hedgecode/snooker/api/SeasonTest.java index 0c618af..545f183 100644 --- a/src/test/java/org/hedgecode/snooker/api/SeasonTest.java +++ b/src/test/java/org/hedgecode/snooker/api/SeasonTest.java @@ -48,7 +48,7 @@ public class SeasonTest extends Assert { } assertEquals( Season.ALL, - Season.getSeason(-1) + Season.getSeason(Season.ALL_SEASONS) ); } diff --git a/src/test/java/org/hedgecode/snooker/json/AbstractJsonTest.java b/src/test/java/org/hedgecode/snooker/json/AbstractJsonTest.java index 0ef6fa6..6158dc3 100644 --- a/src/test/java/org/hedgecode/snooker/json/AbstractJsonTest.java +++ b/src/test/java/org/hedgecode/snooker/json/AbstractJsonTest.java @@ -24,6 +24,7 @@ import java.io.FileReader; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import java.io.Serializable; import com.google.gson.Gson; @@ -49,7 +50,7 @@ public abstract class AbstractJsonTest extends Assert { getClass().getSimpleName() + JSON_EXT ).getFile() ); - private final File serFile = + private final File serializeFile = new File( jsonFile.getParent() + File.separator + getClass().getSimpleName() + SERIALIZE_EXT @@ -79,30 +80,30 @@ public abstract class AbstractJsonTest extends Assert { return sb.toString(); } - protected void serialize(JsonSerializable jsonObject) throws IOException { + protected void serialize(Serializable serializeObject) throws IOException { try (ObjectOutputStream oos = new ObjectOutputStream( new FileOutputStream( - serFile.getAbsolutePath() + serializeFile.getAbsolutePath() ) ) ) { - oos.writeObject(jsonObject); + oos.writeObject(serializeObject); } } - protected JsonSerializable deserialize() throws IOException, ClassNotFoundException { - JsonSerializable jsonObject; + protected Serializable deserialize() throws IOException, ClassNotFoundException { + Serializable deserializeObject; try (ObjectInputStream ois = new ObjectInputStream( new FileInputStream( - serFile.getAbsolutePath() + serializeFile.getAbsolutePath() ) ) ) { - jsonObject = (JsonSerializable) ois.readObject(); + deserializeObject = (Serializable) ois.readObject(); } - return jsonObject; + return deserializeObject; } } -- 2.10.0