RouteWithTrack extends Route { public List<List<Coordinates>> track() { return Collections.unmodifiableList(track); } RouteWithTrack(Route route, List<List<Coordinates>> track); List<List<Coordinates>> track();  }
@Test void cannot_modify_track_externally() { Route route = new Route(vehicle, depot, Arrays.asList(visit1, visit2)); ArrayList<List<Coordinates>> track = new ArrayList<>(); track.add(Arrays.asList(Coordinates.valueOf(1.0, 2.0))); List<List<Coordinates>> routeTrack = new RouteWithTrack(route, track).track(); assertThatExceptionOfType(UnsupportedOperationException.class) .isThrownBy(routeTrack::clear); }