mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
added tests
This commit is contained in:
parent
1423c90407
commit
b6a235bf92
2 changed files with 37 additions and 10 deletions
|
|
@ -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;
|
||||
|
|
@ -46,7 +46,7 @@ public final class Start implements TourActivity {
|
|||
|
||||
private double endTime;
|
||||
|
||||
private double arrTime;
|
||||
private double arrTime;
|
||||
|
||||
public Start(String locationId, double theoreticalStart, double theoreticalEnd) {
|
||||
super();
|
||||
|
|
@ -63,13 +63,13 @@ public final class Start implements TourActivity {
|
|||
theoretical_latestOperationStartTime = start.getTheoreticalLatestOperationStartTime();
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,35 @@
|
|||
package jsprit.core.problem.solution.route.activity;
|
||||
|
||||
public class StartTest {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue