Parcels { public static Builder builder() { return new Builder(); } private  Parcels(); static Builder builder();  }
@Test public void timesTest() { final int scenarioLength = 10; final ParcelGenerator pg = Parcels.builder() .announceTimes(TimeSeries.homogenousPoisson(scenarioLength, 100)) .build(); final List<AddParcelEvent> events = pg.generate(123, TravelTimesUtil.distance(), scenarioLength); for (final AddParcelEvent ape : events) { assertTrue(ape.getTime() < scenarioLength); } TestUtil.testPrivateConstructor(Parcels.class); }
@Test(expected = IllegalArgumentException.class) public void timesFail() { final int scenarioLength = 10; final ParcelGenerator pg2 = Parcels .builder() .announceTimes( TimeSeries.homogenousPoisson(scenarioLength + 0.1, 100)) .build(); pg2.generate(123, TravelTimesUtil.distance(), scenarioLength); }