StationNamer { public static String generateNextStationName(Survey survey, Station originatingStation) { String originatingName = originatingStation.getName(); String newUniqueName = advanceNumberIfNotUnique(survey, originatingName); return newUniqueName; }  static String generateOriginName(); static String generateNextStationName(Survey survey, Station originatingStation); static String advanceNumberIfNotUnique(Survey survey, String candidateName); static Set<String> getAllStationNames(Survey survey);  }
@Test public void testNameAdvancesDigitInStraightLine() { Survey testSurvey = BasicTestSurveyCreator.createStraightNorth(); String newName = StationNamer.generateNextStationName( testSurvey, testSurvey.getActiveStation()); int numberOfStations = testSurvey.getAllStations().size(); Assert.assertEquals(Integer.toString(numberOfStations + 1), newName); }
@Test public void testNameAdvancesNumberOnPotentialBranch() { Survey testSurvey = BasicTestSurveyCreator.createStraightNorth(); String newName = StationNamer.generateNextStationName(testSurvey, testSurvey.getStationByName("1")); int numberOfStations = testSurvey.getAllStations().size(); Assert.assertEquals(Integer.toString(numberOfStations + 1), newName); }
@Test public void testNameAdvancesNumberOnEstablishedBranch() { Survey testSurvey = BasicTestSurveyCreator.createStraightNorthWith1EBranch(); String newName = StationNamer.generateNextStationName( testSurvey, testSurvey.getStationByName("5")); int numberOfStations = testSurvey.getAllStations().size(); Assert.assertEquals(Integer.toString(numberOfStations + 1), newName); }
@Test public void testNameAdvancesNumberFromMiddleOfBranch() { Survey testSurvey = BasicTestSurveyCreator.createStraightNorthWith2EBranch(); String newName = StationNamer.generateNextStationName( testSurvey, testSurvey.getStationByName("5")); int numberOfStations = testSurvey.getAllStations().size(); Assert.assertEquals(Integer.toString(numberOfStations + 1), newName); }