1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

added tests

This commit is contained in:
oblonski 2014-02-18 17:06:54 +01:00
parent 1423c90407
commit b6a235bf92
2 changed files with 37 additions and 10 deletions

View file

@ -25,6 +25,8 @@ public final class Start implements TourActivity {
public static int creation;
private static Capacity capacity = Capacity.Builder.newInstance().build();
public static Start newInstance(String locationId, double theoreticalStart, double theoreticalEnd){
creation++;
return new Start(locationId,theoreticalStart,theoreticalEnd);
@ -36,8 +38,6 @@ public final class Start implements TourActivity {
private String locationId;
private Coordinate coordinate;
private double theoretical_earliestOperationStartTime;
@ -64,12 +64,12 @@ public final class Start implements TourActivity {
endTime = start.getEndTime();
}
@Deprecated
Coordinate getCoordinate() {
return coordinate;
}
@Deprecated
void setCoordinate(Coordinate coordinate) {
this.coordinate = coordinate;
}
@ -156,10 +156,7 @@ public final class Start implements TourActivity {
@Override
public Capacity getCapacity() {
// TODO Auto-generated method stub
return null;
return capacity;
}
}

View file

@ -1,5 +1,35 @@
package jsprit.core.problem.solution.route.activity;
import static org.junit.Assert.*;
import org.junit.Test;
public class StartTest {
@Test
public void whenCallingCapacity_itShouldReturnEmptyCapacity(){
Start start = Start.newInstance("loc", 0., 0.);
assertEquals(0,start.getCapacity().get(0));
}
@Test
public void whenCallingCapacityDemand_itShouldReturnEmptyCapacity(){
Start start = Start.newInstance("loc", 0., 0.);
assertEquals(0,start.getCapacityDemand());
}
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){
Start start = Start.newInstance("loc", 1., 2.);
assertEquals(1.,start.getTheoreticalEarliestOperationStartTime(),0.01);
}
@Test
public void whenStartIsIniWithLatestStart_itShouldBeSetCorrectly(){
Start start = Start.newInstance("loc", 1., 2.);
assertEquals(2.,start.getTheoreticalLatestOperationStartTime(),0.01);
}
}