--- /dev/null
+/*
+ * Copyright (c) 2017. Developed by Hedgecode.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.hedgecode.snooker.json;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Tests for {@link JsonRanking}.
+ *
+ * @author Dmitry Samoshin aka gotty
+ */
+@RunWith(JUnit4.class)
+public class JsonRankingTest extends AbstractJsonTest {
+
+ @Test
+ public void testRanking() throws Exception {
+ JsonRanking[] jsonRankings = GSON.fromJson(
+ JsonStringToken.token(
+ jsonFromFile()
+ ),
+ JsonRanking[].class
+ );
+ //serialize(jsonRankings[0]);
+ JsonRanking expectedRanking = (JsonRanking) deserialize();
+ assertNull(
+ expectedRanking,
+ jsonRankings
+ );
+ JsonRanking actualRanking = jsonRankings[0];
+ assertEquals(
+ expectedRanking,
+ actualRanking
+ );
+ }
+
+ public static void assertEquals(JsonRanking expected, JsonRanking actual) {
+ assertEquals(expected.rankingId(), actual.rankingId());
+ assertEquals(expected.position(), actual.position());
+ assertEquals(expected.playerId(), actual.playerId());
+ assertEquals(expected.season(), actual.season());
+ assertEquals(expected.sum(), actual.sum());
+ assertEquals(expected.rankingType(), actual.rankingType());
+ }
+
+}