|
|
|
@ -52,5 +52,219 @@ public class ReferenceDataParserTest { |
|
|
|
assertEquals("02/12/2018", smart.getComment()); |
|
|
|
assertEquals("02/12/2018", smart.getComment()); |
|
|
|
assertEquals("NAIRN", smart.getStationName()); |
|
|
|
assertEquals("NAIRN", smart.getStationName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testSmartInvalidEnumVal1(){ |
|
|
|
|
|
|
|
String json = "{\"STEPTYPE\":\"B\",\"FROMBERTH\":\"7910\",\"TOBERTH\":\"7904\",\"STANOX\":\"01125\",\"EVENT\":\"Z\",\"PLATFORM\":\"1\"," + |
|
|
|
|
|
|
|
"\"TOLINE\":\"\",\"BERTHOFFSET\":\"+59\",\"ROUTE\":\"\",\"FROMLINE\":\"\",\"TD\":\"IH\",\"COMMENT\":\"02/12/2018\",\"STANME\":\"NAIRN\"}"; |
|
|
|
|
|
|
|
Smart smart = Smart.parseJSON(json); |
|
|
|
|
|
|
|
assertEquals(SmartStepType.BETWEEN, smart.getStepType()); |
|
|
|
|
|
|
|
assertEquals("7910", smart.getFromBerth()); |
|
|
|
|
|
|
|
assertEquals("7904", smart.getToBerth()); |
|
|
|
|
|
|
|
assertEquals("01125", smart.getStanox()); |
|
|
|
|
|
|
|
assertNull(smart.getEvent()); |
|
|
|
|
|
|
|
assertEquals("1", smart.getPlatform()); |
|
|
|
|
|
|
|
assertEquals("", smart.getToLine()); |
|
|
|
|
|
|
|
assertEquals(59, smart.getBerthOffset()); |
|
|
|
|
|
|
|
assertEquals("", smart.getRoute()); |
|
|
|
|
|
|
|
assertEquals("", smart.getFromLine()); |
|
|
|
|
|
|
|
assertEquals("IH", smart.getTd()); |
|
|
|
|
|
|
|
assertEquals("02/12/2018", smart.getComment()); |
|
|
|
|
|
|
|
assertEquals("NAIRN", smart.getStationName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testSmartNormalCase2(){ |
|
|
|
|
|
|
|
String json = "{\"STEPTYPE\":\"B\",\"FROMBERTH\":\"7910\",\"TOBERTH\":\"7904\",\"STANOX\":\"01125\",\"EVENT\":\"A\",\"PLATFORM\":\"1\"," + |
|
|
|
|
|
|
|
"\"TOLINE\":\"\",\"BERTHOFFSET\":\"+59\",\"ROUTE\":\"\",\"FROMLINE\":\"\",\"TD\":\"IH\",\"COMMENT\":\"02/12/2018\",\"STANME\":\"NAIRN\"}"; |
|
|
|
|
|
|
|
Smart smart = Smart.parseJSON(new JSONObject(json)); |
|
|
|
|
|
|
|
assertEquals(SmartStepType.BETWEEN, smart.getStepType()); |
|
|
|
|
|
|
|
assertEquals("7910", smart.getFromBerth()); |
|
|
|
|
|
|
|
assertEquals("7904", smart.getToBerth()); |
|
|
|
|
|
|
|
assertEquals("01125", smart.getStanox()); |
|
|
|
|
|
|
|
assertEquals(SmartEvent.ARRIVE_UP, smart.getEvent()); |
|
|
|
|
|
|
|
assertEquals("1", smart.getPlatform()); |
|
|
|
|
|
|
|
assertEquals("", smart.getToLine()); |
|
|
|
|
|
|
|
assertEquals(59, smart.getBerthOffset()); |
|
|
|
|
|
|
|
assertEquals("", smart.getRoute()); |
|
|
|
|
|
|
|
assertEquals("", smart.getFromLine()); |
|
|
|
|
|
|
|
assertEquals("IH", smart.getTd()); |
|
|
|
|
|
|
|
assertEquals("02/12/2018", smart.getComment()); |
|
|
|
|
|
|
|
assertEquals("NAIRN", smart.getStationName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testSmartInvalidEnumVal2(){ |
|
|
|
|
|
|
|
String json = "{\"STEPTYPE\":\"B\",\"FROMBERTH\":\"7910\",\"TOBERTH\":\"7904\",\"STANOX\":\"01125\",\"EVENT\":\"Z\",\"PLATFORM\":\"1\"," + |
|
|
|
|
|
|
|
"\"TOLINE\":\"\",\"BERTHOFFSET\":\"+59\",\"ROUTE\":\"\",\"FROMLINE\":\"\",\"TD\":\"IH\",\"COMMENT\":\"02/12/2018\",\"STANME\":\"NAIRN\"}"; |
|
|
|
|
|
|
|
Smart smart = Smart.parseJSON(new JSONObject(json)); |
|
|
|
|
|
|
|
assertEquals(SmartStepType.BETWEEN, smart.getStepType()); |
|
|
|
|
|
|
|
assertEquals("7910", smart.getFromBerth()); |
|
|
|
|
|
|
|
assertEquals("7904", smart.getToBerth()); |
|
|
|
|
|
|
|
assertEquals("01125", smart.getStanox()); |
|
|
|
|
|
|
|
assertNull(smart.getEvent()); |
|
|
|
|
|
|
|
assertEquals("1", smart.getPlatform()); |
|
|
|
|
|
|
|
assertEquals("", smart.getToLine()); |
|
|
|
|
|
|
|
assertEquals(59, smart.getBerthOffset()); |
|
|
|
|
|
|
|
assertEquals("", smart.getRoute()); |
|
|
|
|
|
|
|
assertEquals("", smart.getFromLine()); |
|
|
|
|
|
|
|
assertEquals("IH", smart.getTd()); |
|
|
|
|
|
|
|
assertEquals("02/12/2018", smart.getComment()); |
|
|
|
|
|
|
|
assertEquals("NAIRN", smart.getStationName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testSmartNormalCase3(){ |
|
|
|
|
|
|
|
String json = "{\"STEPTYPE\":\"B\",\"FROMBERTH\":\"7910\",\"TOBERTH\":\"7904\",\"STANOX\":\"01125\",\"EVENT\":\"A\",\"PLATFORM\":\"1\"," + |
|
|
|
|
|
|
|
"\"TOLINE\":\"\",\"BERTHOFFSET\":\"-59\",\"ROUTE\":\"\",\"FROMLINE\":\"\",\"TD\":\"IH\",\"COMMENT\":\"02/12/2018\",\"STANME\":\"NAIRN\"}"; |
|
|
|
|
|
|
|
Smart smart = Smart.parseJSON(json); |
|
|
|
|
|
|
|
assertEquals(SmartStepType.BETWEEN, smart.getStepType()); |
|
|
|
|
|
|
|
assertEquals("7910", smart.getFromBerth()); |
|
|
|
|
|
|
|
assertEquals("7904", smart.getToBerth()); |
|
|
|
|
|
|
|
assertEquals("01125", smart.getStanox()); |
|
|
|
|
|
|
|
assertEquals(SmartEvent.ARRIVE_UP, smart.getEvent()); |
|
|
|
|
|
|
|
assertEquals("1", smart.getPlatform()); |
|
|
|
|
|
|
|
assertEquals("", smart.getToLine()); |
|
|
|
|
|
|
|
assertEquals(-59, smart.getBerthOffset()); |
|
|
|
|
|
|
|
assertEquals("", smart.getRoute()); |
|
|
|
|
|
|
|
assertEquals("", smart.getFromLine()); |
|
|
|
|
|
|
|
assertEquals("IH", smart.getTd()); |
|
|
|
|
|
|
|
assertEquals("02/12/2018", smart.getComment()); |
|
|
|
|
|
|
|
assertEquals("NAIRN", smart.getStationName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testSmartInvalidEnumVal3(){ |
|
|
|
|
|
|
|
String json = "{\"STEPTYPE\":\"B\",\"FROMBERTH\":\"7910\",\"TOBERTH\":\"7904\",\"STANOX\":\"01125\",\"EVENT\":\"Z\",\"PLATFORM\":\"1\"," + |
|
|
|
|
|
|
|
"\"TOLINE\":\"\",\"BERTHOFFSET\":\"-59\",\"ROUTE\":\"\",\"FROMLINE\":\"\",\"TD\":\"IH\",\"COMMENT\":\"02/12/2018\",\"STANME\":\"NAIRN\"}"; |
|
|
|
|
|
|
|
Smart smart = Smart.parseJSON(json); |
|
|
|
|
|
|
|
assertEquals(SmartStepType.BETWEEN, smart.getStepType()); |
|
|
|
|
|
|
|
assertEquals("7910", smart.getFromBerth()); |
|
|
|
|
|
|
|
assertEquals("7904", smart.getToBerth()); |
|
|
|
|
|
|
|
assertEquals("01125", smart.getStanox()); |
|
|
|
|
|
|
|
assertNull(smart.getEvent()); |
|
|
|
|
|
|
|
assertEquals("1", smart.getPlatform()); |
|
|
|
|
|
|
|
assertEquals("", smart.getToLine()); |
|
|
|
|
|
|
|
assertEquals(-59, smart.getBerthOffset()); |
|
|
|
|
|
|
|
assertEquals("", smart.getRoute()); |
|
|
|
|
|
|
|
assertEquals("", smart.getFromLine()); |
|
|
|
|
|
|
|
assertEquals("IH", smart.getTd()); |
|
|
|
|
|
|
|
assertEquals("02/12/2018", smart.getComment()); |
|
|
|
|
|
|
|
assertEquals("NAIRN", smart.getStationName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testSmartNormalCase4(){ |
|
|
|
|
|
|
|
String json = "{\"STEPTYPE\":\"B\",\"FROMBERTH\":\"7910\",\"TOBERTH\":\"7904\",\"STANOX\":\"01125\",\"EVENT\":\"A\",\"PLATFORM\":\"1\"," + |
|
|
|
|
|
|
|
"\"TOLINE\":\"\",\"BERTHOFFSET\":\"-59\",\"ROUTE\":\"\",\"FROMLINE\":\"\",\"TD\":\"IH\",\"COMMENT\":\"02/12/2018\",\"STANME\":\"NAIRN\"}"; |
|
|
|
|
|
|
|
Smart smart = Smart.parseJSON(new JSONObject(json)); |
|
|
|
|
|
|
|
assertEquals(SmartStepType.BETWEEN, smart.getStepType()); |
|
|
|
|
|
|
|
assertEquals("7910", smart.getFromBerth()); |
|
|
|
|
|
|
|
assertEquals("7904", smart.getToBerth()); |
|
|
|
|
|
|
|
assertEquals("01125", smart.getStanox()); |
|
|
|
|
|
|
|
assertEquals(SmartEvent.ARRIVE_UP, smart.getEvent()); |
|
|
|
|
|
|
|
assertEquals("1", smart.getPlatform()); |
|
|
|
|
|
|
|
assertEquals("", smart.getToLine()); |
|
|
|
|
|
|
|
assertEquals(-59, smart.getBerthOffset()); |
|
|
|
|
|
|
|
assertEquals("", smart.getRoute()); |
|
|
|
|
|
|
|
assertEquals("", smart.getFromLine()); |
|
|
|
|
|
|
|
assertEquals("IH", smart.getTd()); |
|
|
|
|
|
|
|
assertEquals("02/12/2018", smart.getComment()); |
|
|
|
|
|
|
|
assertEquals("NAIRN", smart.getStationName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testSmartInvalidEnumVal4(){ |
|
|
|
|
|
|
|
String json = "{\"STEPTYPE\":\"B\",\"FROMBERTH\":\"7910\",\"TOBERTH\":\"7904\",\"STANOX\":\"01125\",\"EVENT\":\"Z\",\"PLATFORM\":\"1\"," + |
|
|
|
|
|
|
|
"\"TOLINE\":\"\",\"BERTHOFFSET\":\"-59\",\"ROUTE\":\"\",\"FROMLINE\":\"\",\"TD\":\"IH\",\"COMMENT\":\"02/12/2018\",\"STANME\":\"NAIRN\"}"; |
|
|
|
|
|
|
|
Smart smart = Smart.parseJSON(new JSONObject(json)); |
|
|
|
|
|
|
|
assertEquals(SmartStepType.BETWEEN, smart.getStepType()); |
|
|
|
|
|
|
|
assertEquals("7910", smart.getFromBerth()); |
|
|
|
|
|
|
|
assertEquals("7904", smart.getToBerth()); |
|
|
|
|
|
|
|
assertEquals("01125", smart.getStanox()); |
|
|
|
|
|
|
|
assertNull(smart.getEvent()); |
|
|
|
|
|
|
|
assertEquals("1", smart.getPlatform()); |
|
|
|
|
|
|
|
assertEquals("", smart.getToLine()); |
|
|
|
|
|
|
|
assertEquals(-59, smart.getBerthOffset()); |
|
|
|
|
|
|
|
assertEquals("", smart.getRoute()); |
|
|
|
|
|
|
|
assertEquals("", smart.getFromLine()); |
|
|
|
|
|
|
|
assertEquals("IH", smart.getTd()); |
|
|
|
|
|
|
|
assertEquals("02/12/2018", smart.getComment()); |
|
|
|
|
|
|
|
assertEquals("NAIRN", smart.getStationName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testSmartNormalCase6(){ |
|
|
|
|
|
|
|
String json = "{\"STEPTYPE\":\"B\",\"FROMBERTH\":\"7910\",\"TOBERTH\":\"7904\",\"STANOX\":\"01125\",\"EVENT\":\"A\",\"PLATFORM\":\"1\"," + |
|
|
|
|
|
|
|
"\"TOLINE\":\"\",\"BERTHOFFSET\":\"59\",\"ROUTE\":\"\",\"FROMLINE\":\"\",\"TD\":\"IH\",\"COMMENT\":\"02/12/2018\",\"STANME\":\"NAIRN\"}"; |
|
|
|
|
|
|
|
Smart smart = Smart.parseJSON(json); |
|
|
|
|
|
|
|
assertEquals(SmartStepType.BETWEEN, smart.getStepType()); |
|
|
|
|
|
|
|
assertEquals("7910", smart.getFromBerth()); |
|
|
|
|
|
|
|
assertEquals("7904", smart.getToBerth()); |
|
|
|
|
|
|
|
assertEquals("01125", smart.getStanox()); |
|
|
|
|
|
|
|
assertEquals(SmartEvent.ARRIVE_UP, smart.getEvent()); |
|
|
|
|
|
|
|
assertEquals("1", smart.getPlatform()); |
|
|
|
|
|
|
|
assertEquals("", smart.getToLine()); |
|
|
|
|
|
|
|
assertEquals(59, smart.getBerthOffset()); |
|
|
|
|
|
|
|
assertEquals("", smart.getRoute()); |
|
|
|
|
|
|
|
assertEquals("", smart.getFromLine()); |
|
|
|
|
|
|
|
assertEquals("IH", smart.getTd()); |
|
|
|
|
|
|
|
assertEquals("02/12/2018", smart.getComment()); |
|
|
|
|
|
|
|
assertEquals("NAIRN", smart.getStationName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testSmartInvalidEnumVal6(){ |
|
|
|
|
|
|
|
String json = "{\"STEPTYPE\":\"B\",\"FROMBERTH\":\"7910\",\"TOBERTH\":\"7904\",\"STANOX\":\"01125\",\"EVENT\":\"Z\",\"PLATFORM\":\"1\"," + |
|
|
|
|
|
|
|
"\"TOLINE\":\"\",\"BERTHOFFSET\":\"59\",\"ROUTE\":\"\",\"FROMLINE\":\"\",\"TD\":\"IH\",\"COMMENT\":\"02/12/2018\",\"STANME\":\"NAIRN\"}"; |
|
|
|
|
|
|
|
Smart smart = Smart.parseJSON(json); |
|
|
|
|
|
|
|
assertEquals(SmartStepType.BETWEEN, smart.getStepType()); |
|
|
|
|
|
|
|
assertEquals("7910", smart.getFromBerth()); |
|
|
|
|
|
|
|
assertEquals("7904", smart.getToBerth()); |
|
|
|
|
|
|
|
assertEquals("01125", smart.getStanox()); |
|
|
|
|
|
|
|
assertNull(smart.getEvent()); |
|
|
|
|
|
|
|
assertEquals("1", smart.getPlatform()); |
|
|
|
|
|
|
|
assertEquals("", smart.getToLine()); |
|
|
|
|
|
|
|
assertEquals(59, smart.getBerthOffset()); |
|
|
|
|
|
|
|
assertEquals("", smart.getRoute()); |
|
|
|
|
|
|
|
assertEquals("", smart.getFromLine()); |
|
|
|
|
|
|
|
assertEquals("IH", smart.getTd()); |
|
|
|
|
|
|
|
assertEquals("02/12/2018", smart.getComment()); |
|
|
|
|
|
|
|
assertEquals("NAIRN", smart.getStationName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testSmartNormalCase5(){ |
|
|
|
|
|
|
|
String json = "{\"STEPTYPE\":\"B\",\"FROMBERTH\":\"7910\",\"TOBERTH\":\"7904\",\"STANOX\":\"01125\",\"EVENT\":\"A\",\"PLATFORM\":\"1\"," + |
|
|
|
|
|
|
|
"\"TOLINE\":\"\",\"BERTHOFFSET\":\"59\",\"ROUTE\":\"\",\"FROMLINE\":\"\",\"TD\":\"IH\",\"COMMENT\":\"02/12/2018\",\"STANME\":\"NAIRN\"}"; |
|
|
|
|
|
|
|
Smart smart = Smart.parseJSON(new JSONObject(json)); |
|
|
|
|
|
|
|
assertEquals(SmartStepType.BETWEEN, smart.getStepType()); |
|
|
|
|
|
|
|
assertEquals("7910", smart.getFromBerth()); |
|
|
|
|
|
|
|
assertEquals("7904", smart.getToBerth()); |
|
|
|
|
|
|
|
assertEquals("01125", smart.getStanox()); |
|
|
|
|
|
|
|
assertEquals(SmartEvent.ARRIVE_UP, smart.getEvent()); |
|
|
|
|
|
|
|
assertEquals("1", smart.getPlatform()); |
|
|
|
|
|
|
|
assertEquals("", smart.getToLine()); |
|
|
|
|
|
|
|
assertEquals(59, smart.getBerthOffset()); |
|
|
|
|
|
|
|
assertEquals("", smart.getRoute()); |
|
|
|
|
|
|
|
assertEquals("", smart.getFromLine()); |
|
|
|
|
|
|
|
assertEquals("IH", smart.getTd()); |
|
|
|
|
|
|
|
assertEquals("02/12/2018", smart.getComment()); |
|
|
|
|
|
|
|
assertEquals("NAIRN", smart.getStationName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testSmartInvalidEnumVal5(){ |
|
|
|
|
|
|
|
String json = "{\"STEPTYPE\":\"B\",\"FROMBERTH\":\"7910\",\"TOBERTH\":\"7904\",\"STANOX\":\"01125\",\"EVENT\":\"Z\",\"PLATFORM\":\"1\"," + |
|
|
|
|
|
|
|
"\"TOLINE\":\"\",\"BERTHOFFSET\":\"59\",\"ROUTE\":\"\",\"FROMLINE\":\"\",\"TD\":\"IH\",\"COMMENT\":\"02/12/2018\",\"STANME\":\"NAIRN\"}"; |
|
|
|
|
|
|
|
Smart smart = Smart.parseJSON(new JSONObject(json)); |
|
|
|
|
|
|
|
assertEquals(SmartStepType.BETWEEN, smart.getStepType()); |
|
|
|
|
|
|
|
assertEquals("7910", smart.getFromBerth()); |
|
|
|
|
|
|
|
assertEquals("7904", smart.getToBerth()); |
|
|
|
|
|
|
|
assertEquals("01125", smart.getStanox()); |
|
|
|
|
|
|
|
assertNull(smart.getEvent()); |
|
|
|
|
|
|
|
assertEquals("1", smart.getPlatform()); |
|
|
|
|
|
|
|
assertEquals("", smart.getToLine()); |
|
|
|
|
|
|
|
assertEquals(59, smart.getBerthOffset()); |
|
|
|
|
|
|
|
assertEquals("", smart.getRoute()); |
|
|
|
|
|
|
|
assertEquals("", smart.getFromLine()); |
|
|
|
|
|
|
|
assertEquals("IH", smart.getTd()); |
|
|
|
|
|
|
|
assertEquals("02/12/2018", smart.getComment()); |
|
|
|
|
|
|
|
assertEquals("NAIRN", smart.getStationName()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|