Ignore:
Timestamp:
2016-08-16T14:03:50+02:00 (9 years ago)
Author:
xamanu
Message:

Allowing multiple stop positions and platforms in stop area checks

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  
    3333                Assert.assertEquals(nodeChecker.getErrors().size(), 1);
    3434                Assert.assertEquals(nodeChecker.getErrors().get(0).getCode(),
    35                                 PTAssistantValidatorTest.ERROR_CODE_NODE_PART_OF_STOP_AREA);
     35                                PTAssistantValidatorTest.ERROR_CODE_NOT_PART_OF_STOP_AREA);
    3636        }
    3737       
     
    3939
    4040        @Test
    41         public void stopPositionComparePlatformRelations() {
     41        public void stopAreaRelationsTest() {
    4242               
    4343                // Check if stop positions belong the same routes as related platform(s)
     
    4646                DataSet ds = ImportUtils.importOsmFile(file, "testLayer");
    4747                PTAssistantValidatorTest test = new PTAssistantValidatorTest();
    48                 Node node = null;
     48                Relation stopArea = null;
    4949               
    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;
    5353                        }
    5454                }
    5555               
    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);               
    6261        }
    6362       
     
    6665        public void stopAreaStopPositionTest() {
    6766               
    68                 // Check if stop area relation has one stop position.
     67                // Check if stop area relation has at least one stop position.
    6968               
    7069                File file = new File(AbstractTest.PATH_TO_STOP_AREA_NO_STOPS);
     
    8786        }
    8887       
    89         @Test
    90         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        
    11388
    11489        @Test
    11590        public void stopAreaPlatformTest() {
    11691               
    117                 // Check if stop area relation has one platform.
     92                // Check if stop area relation has at least one platform.
    11893               
    11994                File file = new File(AbstractTest.PATH_TO_STOP_AREA_NO_PLATFORMS);
     
    135110
    136111        }
    137        
    138         @Test
    139         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         }
    161112
    162113}
Note: See TracChangeset for help on using the changeset viewer.