SurveyUpdater { public static void moveLeg(Survey survey, Leg leg, Station newSource) { Station originating = survey.getOriginatingStation(leg); originating.getOnwardLegs().remove(leg); newSource.addOnwardLeg(leg); survey.setSaved(false); }  static boolean update(Survey survey, List<Leg> legs, InputMode inputMode); static boolean update(Survey survey, List<Leg> legs); static boolean update(Survey survey, Leg leg); static synchronized boolean update(Survey survey, Leg leg, InputMode inputMode); static void updateWithNewStation(Survey survey, Leg leg); static void upgradeSplayToConnectedLeg(Survey survey, Leg leg, InputMode inputMode); static synchronized void editLeg(
            final Survey survey, final Leg toEdit, final Leg edited); static void renameStation(Survey survey, Station station, String name); static void moveLeg(Survey survey, Leg leg, Station newSource); static void deleteStation(final Survey survey, final Station toDelete); static void deleteSplay(Survey survey, Station station, Leg splay); static boolean areLegsBacksights(Leg fore, Leg back); static Leg averageLegs(List<Leg> repeats); static Leg averageBacksights(Leg fore, Leg back); static void reverseLeg(final Survey survey, final Station toReverse); static void setDirectionOfSubtree(Survey survey, Station station, Direction direction);  }
@Test public void testMoveLegWorks() { Survey survey = BasicTestSurveyCreator.createStraightNorth(); Leg toMove = survey.getStationByName("2").getOnwardLegs().get(0); Station originatingStation = survey.getOriginatingStation(toMove); Station destinationStation = survey.getStationByName("1"); Assert.assertNotEquals(originatingStation, destinationStation); SurveyUpdater.moveLeg(survey, toMove, destinationStation); Assert.assertTrue(destinationStation.getOnwardLegs().contains(toMove)); Assert.assertFalse(originatingStation.getOnwardLegs().contains(toMove)); }