@Test public void testIsDataVersion() { CoPilot6Format coPilot6Format = new CoPilot6Format(); assertTrue(coPilot6Format.isDataVersion("Data Version=6.0.0.27")); assertFalse(coPilot6Format.isDataVersion("Data Version:6.0.0.27")); assertFalse(coPilot6Format.isDataVersion("Data Version=7.0.0.27")); assertFalse(coPilot6Format.isDataVersion("Data Version=1.0.0.27")); assertFalse(coPilot6Format.isDataVersion("Data Version=2.0.0.27")); CoPilot7Format coPilot7Format = new CoPilot7Format(); assertTrue(coPilot7Format.isDataVersion("Data Version=7.0.0.27")); assertFalse(coPilot7Format.isDataVersion("Data Version:7.0.0.27")); assertFalse(coPilot7Format.isDataVersion("Data Version=6.0.0.27")); assertFalse(coPilot7Format.isDataVersion("Data Version=8.0.0.27")); CoPilot8Format coPilot8Format = new CoPilot8Format(); assertTrue(coPilot8Format.isDataVersion("Data Version:1.13.5.2")); assertFalse(coPilot8Format.isDataVersion("Data Version=1.13.5.2")); assertFalse(coPilot8Format.isDataVersion("Data Version=2.13.5.2")); CoPilot9Format coPilot9Format = new CoPilot9Format(); assertTrue(coPilot9Format.isDataVersion("Data Version:2.14.6.1")); assertFalse(coPilot9Format.isDataVersion("Data Version=1.14.6.1")); assertFalse(coPilot9Format.isDataVersion("Data Version=2.14.6.1")); }
@Test public void testParsePosition() { Map<String, String> map = new HashMap<>(); map.put("Longitude", "11753270"); map.put("Latitude", "47688350"); Wgs84Position position1 = format.parsePosition(map); assertNotNull(position1); assertDoubleEquals(11.75327, position1.getLongitude()); assertDoubleEquals(47.68835, position1.getLatitude()); assertNull(position1.getElevation()); assertNull(position1.getTime()); assertNull(position1.getDescription()); map.put("City", "Innsbruck"); map.put("County", "Tirol"); Wgs84Position position2 = format.parsePosition(map); assertNotNull(position2); assertEquals("Innsbruck, Tirol", position2.getDescription()); map.put("State", "A"); Wgs84Position position3 = format.parsePosition(map); assertNotNull(position3); assertEquals("A Innsbruck, Tirol", position3.getDescription()); map.put("Address", "39 Gumppstrasse"); map.put("Zip", "6020"); Wgs84Position position4 = format.parsePosition(map); assertNotNull(position4); assertEquals("A-6020 Innsbruck, Tirol, 39 Gumppstrasse", position4.getDescription()); }
@Test public void testIsDataVersion() { CoPilot6Format coPilot6Format = new CoPilot6Format(); assertTrue(coPilot6Format.isDataVersion("Data Version=6.0.0.27")); assertFalse(coPilot6Format.isDataVersion("Data Version:6.0.0.27")); CoPilot7Format coPilot7Format = new CoPilot7Format(); assertTrue(coPilot7Format.isDataVersion("Data Version=7.0.0.27")); assertFalse(coPilot7Format.isDataVersion("Data Version:7.0.0.27")); CoPilot8Format coPilot8Format = new CoPilot8Format(); assertTrue(coPilot8Format.isDataVersion("Data Version:8.0.0.27")); assertFalse(coPilot8Format.isDataVersion("Data Version=8.0.0.27")); }
@Test public void testIsValidLine() { assertTrue(format.isNameValue("Data Version=6.0.0.27")); assertTrue(format.isNameValue("Start Stop=Stop 0")); assertTrue(format.isNameValue("Start StopOpt=Stop 3")); assertTrue(format.isNameValue("Memo=")); assertFalse(format.isNameValue("End Trip")); assertFalse(format.isNameValue("End Stop")); assertFalse(format.isNameValue("End StopOpt")); assertFalse(format.isNameValue("Egal")); }