ShallowRoute { @Override public String toString() { String route = Stream.concat(Stream.of(depotId), visitIds.stream()) .map(Object::toString) .collect(joining("->", "[", "]")); return vehicleId + ": " + route; } ShallowRoute(long vehicleId, long depotId, List<Long> visitIds); @Override String toString(); final long vehicleId; final long depotId; final List<Long> visitIds; }
@Test void shallow_route_to_string() { ShallowRoute shallowRoute = new ShallowRoute(200L, 100L, Arrays.asList(93L, 92L, 91L)); assertThat(shallowRoute.toString()).containsSubsequence("200", "100", "93", "92", "91"); }