RouteAndActivityStateGetter stateGetter = mock(RouteAndActivityStateGetter.class);
when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_BEGINNING, Capacity.class)).thenReturn(atBeginning);
when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_END, Capacity.class)).thenReturn(atEnd);
when(stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class)).thenReturn(atBeginning);
JobInsertionContext iContext = mock(JobInsertionContext.class);
when(iContext.getJob()).thenReturn(service);
when(iContext.getRoute()).thenReturn(route);
VehicleType type = mock(VehicleType.class);
when(type.getCapacityDimensions()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 2).addDimension(1, 1).addDimension(2, 2).build());
Vehicle vehicle = mock(Vehicle.class);
when(vehicle.getType()).thenReturn(type);
when(iContext.getNewVehicle()).thenReturn(vehicle);
ServiceLoadRouteLevelConstraint constraint = new ServiceLoadRouteLevelConstraint(stateGetter);
assertFalse(constraint.fulfilled(iContext));
}