From 83d2af8f3acd8838fc3852bdf9fcff9b7485c75a Mon Sep 17 00:00:00 2001 From: oblonski <4sschroeder@gmail.com> Date: Wed, 3 Sep 2014 10:52:54 +0200 Subject: [PATCH] bugfix 122 --- .../problem/VehicleRoutingProblemTest.java | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/jsprit-core/src/test/java/jsprit/core/problem/VehicleRoutingProblemTest.java b/jsprit-core/src/test/java/jsprit/core/problem/VehicleRoutingProblemTest.java index f80bf1f8..414f29dc 100644 --- a/jsprit-core/src/test/java/jsprit/core/problem/VehicleRoutingProblemTest.java +++ b/jsprit-core/src/test/java/jsprit/core/problem/VehicleRoutingProblemTest.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 Stefan Schroeder + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either + * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . ******************************************************************************/ @@ -139,6 +139,23 @@ public class VehicleRoutingProblemTest { assertEquals(s1,vrp.getJobs().get("s1")); assertEquals(s2,vrp.getJobs().get("s2")); } + + @Test + public void whenServicesAreAdded_vrpShouldContainThemV2(){ + Service s1 = mock(Service.class); + when(s1.getId()).thenReturn("s1"); + Service s2 = mock(Service.class); + when(s2.getId()).thenReturn("s2"); + + VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); + vrpBuilder.addJob(s1).addJob(s2); + + VehicleRoutingProblem vrp = vrpBuilder.build(); + + assertEquals(2,vrp.getJobs().size()); + assertEquals(s1,vrp.getJobs().get("s1")); + assertEquals(s2,vrp.getJobs().get("s2")); + } @Test public void whenPickupsAreAdded_vrpShouldContainThem(){