Changeset 32822 in osm for applications/editors/josm/plugins/pt_assistant/test/unit
- Timestamp:
- 2016-08-16T14:03:50+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/validation/StopCheckerTest.java
r32783 r32822 33 33 Assert.assertEquals(nodeChecker.getErrors().size(), 1); 34 34 Assert.assertEquals(nodeChecker.getErrors().get(0).getCode(), 35 PTAssistantValidatorTest.ERROR_CODE_NO DE_PART_OF_STOP_AREA);35 PTAssistantValidatorTest.ERROR_CODE_NOT_PART_OF_STOP_AREA); 36 36 } 37 37 … … 39 39 40 40 @Test 41 public void stop PositionComparePlatformRelations() {41 public void stopAreaRelationsTest() { 42 42 43 43 // Check if stop positions belong the same routes as related platform(s) … … 46 46 DataSet ds = ImportUtils.importOsmFile(file, "testLayer"); 47 47 PTAssistantValidatorTest test = new PTAssistantValidatorTest(); 48 Node node= null;48 Relation stopArea = null; 49 49 50 for ( Node n: ds.getNodes()) {51 if ( n.hasTag("public_transport", "stop_position")) {52 node = n;50 for (Relation r : ds.getRelations()) { 51 if (r.hasTag("public_transport", "stop_area")) { 52 stopArea = r; 53 53 } 54 54 } 55 55 56 NodeChecker nodeChecker = new NodeChecker(node, test); 57 nodeChecker.performStopPositionComparePlatformRelations(); 58 Assert.assertEquals(nodeChecker.getErrors().size(), 1); 59 Assert.assertEquals(nodeChecker.getErrors().get(0).getCode(), 60 PTAssistantValidatorTest.ERROR_CODE_STOP_POSITION_COMPARE_RELATIONS); 61 56 StopChecker stopChecker = new StopChecker(stopArea, test); 57 stopChecker.performStopAreaRelationsTest(); 58 Assert.assertEquals(stopChecker.getErrors().size(), 1); 59 Assert.assertEquals(stopChecker.getErrors().get(0).getCode(), 60 PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_COMPARE_RELATIONS); 62 61 } 63 62 … … 66 65 public void stopAreaStopPositionTest() { 67 66 68 // Check if stop area relation has one stop position. 67 // Check if stop area relation has at least one stop position. 69 68 70 69 File file = new File(AbstractTest.PATH_TO_STOP_AREA_NO_STOPS); … … 87 86 } 88 87 89 @Test90 public void stopAreaMultiStopPositionTest() {91 92 // Check if stop area relation has more than one stop position.93 94 File file = new File(AbstractTest.PATH_TO_STOP_AREA_MANY_STOPS);95 DataSet ds = ImportUtils.importOsmFile(file, "testLayer");96 PTAssistantValidatorTest test = new PTAssistantValidatorTest();97 Relation stopArea = null;98 99 for (Relation r : ds.getRelations()) {100 if (r.hasTag("public_transport", "stop_area")) {101 stopArea = r;102 }103 }104 105 StopChecker stopChecker = new StopChecker(stopArea, test);106 stopChecker.performStopAreaMultiStopPositionTest();107 Assert.assertEquals(stopChecker.getErrors().size(), 1);108 Assert.assertEquals(stopChecker.getErrors().get(0).getCode(),109 PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_MANY_STOPS);110 111 }112 113 88 114 89 @Test 115 90 public void stopAreaPlatformTest() { 116 91 117 // Check if stop area relation has one platform. 92 // Check if stop area relation has at least one platform. 118 93 119 94 File file = new File(AbstractTest.PATH_TO_STOP_AREA_NO_PLATFORMS); … … 135 110 136 111 } 137 138 @Test139 public void stopAreaMultiPlatformTest() {140 141 // Check if stop area relation has more than one stop position.142 143 File file = new File(AbstractTest.PATH_TO_STOP_AREA_MANY_PLATFORMS);144 DataSet ds = ImportUtils.importOsmFile(file, "testLayer");145 PTAssistantValidatorTest test = new PTAssistantValidatorTest();146 Relation stopArea = null;147 148 for (Relation r : ds.getRelations()) {149 if (r.hasTag("public_transport", "stop_area")) {150 stopArea = r;151 }152 }153 154 StopChecker stopChecker = new StopChecker(stopArea, test);155 stopChecker.performStopAreaMultiPlatformTest();156 Assert.assertEquals(stopChecker.getErrors().size(), 1);157 Assert.assertEquals(stopChecker.getErrors().get(0).getCode(),158 PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_MANY_PLATFORMS);159 160 }161 112 162 113 }
Note:
See TracChangeset
for help on using the changeset viewer.
