DataSetMarshaller { public String marshal(RoutingProblem routingProblem) { return marshal(toDataSet(routingProblem)); } DataSetMarshaller();   DataSetMarshaller(ObjectMapper mapper); RoutingProblem unmarshal(Reader reader); String marshal(RoutingProblem routingProblem);  }
@Test void marshal_data_set() { DataSet dataSet = new DataSet(); String name = "Test data set"; dataSet.setName(name); DataSetLocation depot = new DataSetLocation("Depot", -1.1, -9.9); DataSetLocation location1 = new DataSetLocation("Location 1", 1.0, 0.1); DataSetLocation location2 = new DataSetLocation("Location 2", 2.0, 0.2); dataSet.setDepot(depot); dataSet.setVisits(Arrays.asList(location1, location2)); DataSetVehicle vehicle1 = new DataSetVehicle("Vehicle 1", 123); DataSetVehicle vehicle2 = new DataSetVehicle("Vehicle 2", 222); dataSet.setVehicles(Arrays.asList(vehicle1, vehicle2)); String yaml = new DataSetMarshaller().marshal(dataSet); assertThat(yaml) .contains("name: \"" + name) .contains( depot.getLabel(), location1.getLabel(), location2.getLabel(), vehicle1.name, vehicle2.name, String.valueOf(vehicle1.capacity), String.valueOf(vehicle2.capacity)); }