Beispiel #1
0
 @Test
 public void whenAddingTwoCapDimension_nuOfDimsShouldBeTwo() {
   VehicleTypeImpl type =
       VehicleTypeImpl.Builder.newInstance("t")
           .addCapacityDimension(0, 2)
           .addCapacityDimension(1, 4)
           .build();
   assertEquals(2, type.getCapacityDimensions().getNuOfDimensions());
 }
Beispiel #2
0
 @Test
 public void whenAddingTwoCapDimension_dimValuesMustBeCorrect() {
   VehicleTypeImpl type =
       VehicleTypeImpl.Builder.newInstance("t")
           .addCapacityDimension(0, 2)
           .addCapacityDimension(1, 4)
           .build();
   assertEquals(2, type.getCapacityDimensions().get(0));
   assertEquals(4, type.getCapacityDimensions().get(1));
 }
Beispiel #3
0
 @Test
 public void whenSettingMaxVelocity_itShouldBeSetCorrectly() {
   VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type").setMaxVelocity(10).build();
   assertEquals(10, type.getMaxVelocity(), 0.0);
 }
Beispiel #4
0
 @Test(expected = IllegalArgumentException.class)
 public void whenBuildingTypeWithNullId_throwIllegalStateException() {
   @SuppressWarnings("unused")
   VehicleTypeImpl type =
       VehicleTypeImpl.Builder.newInstance(null).addCapacityDimension(0, 10).build();
 }
Beispiel #5
0
 @Test
 public void whenBuildingTypeJustByCallingNewInstance_capMustBeCorrect() {
   VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("foo").build();
   assertEquals(0, type.getCapacityDimensions().get(0));
 }
Beispiel #6
0
 @Test
 public void whenBuildingTypeJustByCallingNewInstance_typeIdMustBeCorrect() {
   VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("foo").build();
   assertEquals("foo", type.getTypeId());
 }
Beispiel #7
0
 @Test
 public void whenCallingStaticNewBuilderInstance_itShouldReturnNewBuilderInstance() {
   VehicleTypeImpl.Builder builder = VehicleTypeImpl.Builder.newInstance("foo");
   assertNotNull(builder);
 }
Beispiel #8
0
 @Test
 public void whenTypeIsBuiltWithoutSpecifyingCapacity_itShouldHvCapDimValOfZero() {
   VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("t").build();
   assertEquals(0, type.getCapacityDimensions().get(0));
 }
Beispiel #9
0
 @Test
 public void whenTypeIsBuiltWithoutSpecifyingCapacity_itShouldHvCapWithOneDim() {
   VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("t").build();
   assertEquals(1, type.getCapacityDimensions().getNuOfDimensions());
 }
Beispiel #10
0
 @Test(expected = IllegalArgumentException.class)
 public void whenTypeHasNegativeCapacityVal_throwIllegalStateExpception() {
   @SuppressWarnings("unused")
   VehicleTypeImpl type =
       VehicleTypeImpl.Builder.newInstance("t").addCapacityDimension(0, -10).build();
 }
Beispiel #11
0
 @Test
 public void whenAddingProfile_itShouldBeCorrect() {
   VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type").setProfile("car").build();
   assertEquals("car", type.getProfile());
 }
Beispiel #12
0
 @Test
 public void whenHavingTwoTypesWithTheSameId_theyShouldBeEqual() {
   VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type").setCostPerTime(10).build();
   VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("type").setCostPerTime(10).build();
   assertTrue(type.equals(type2));
 }
Beispiel #13
0
 @Test
 public void whenSettingPerTimeCosts_itShouldBeSetCorrectly() {
   VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type").setCostPerTime(10).build();
   assertEquals(10.0, type.getVehicleCostParams().perTimeUnit, 0.0);
 }
Beispiel #14
0
 @Test(expected = IllegalArgumentException.class)
 public void whenPerTimeCostsSmallerThanZero_itShouldThrowException() {
   @SuppressWarnings("unused")
   VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type").setCostPerTime(-10).build();
 }
Beispiel #15
0
 public void whenSettingFixedCosts_itShouldBeSetCorrectly() {
   VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type").setFixedCost(10).build();
   assertEquals(10.0, type.getVehicleCostParams().fix, 0.0);
 }