UtilizationModelStochastic extends UtilizationModelAbstract { protected Double getUtilizationHistory(final double time) { return historyMap.get(time); } UtilizationModelStochastic();  UtilizationModelStochastic(final Unit unit);  UtilizationModelStochastic(final Unit unit, final long seed);  UtilizationModelStochastic(final long seed);  UtilizationModelStochastic(final ContinuousDistribution prng);  UtilizationModelStochastic(final Unit unit, final ContinuousDistribution prng); void saveHistory(final String filename); @SuppressWarnings("unchecked") void loadHistory(final String filename); ContinuousDistribution getRandomGenerator(); final void setRandomGenerator(final ContinuousDistribution randomGenerator); boolean isHistoryEnabled(); UtilizationModelStochastic setHistoryEnabled(final boolean enable); boolean isAlwaysGenerateNewRandomUtilization(); UtilizationModelStochastic setAlwaysGenerateNewRandomUtilization(final boolean alwaysGenerateNewRandomUtilization);  }
@Test public void testUtilizationCallSequence() { final int MAX_TIME = 4; IntStream.range(0, MAX_TIME).forEach(time -> utilizationModel.getUtilization(time)); IntStream.range(0, MAX_TIME).forEach(time -> { final double expected = utilizationModel.getUtilizationHistory(time); assertEquals(expected, utilizationModel.getUtilization(time), "Utilization for time " + time); }); final ContinuousDistribution prng = new UniformDistr(0, MAX_TIME); for (int i = 0; i < MAX_TIME; i++) { final int time = (int)prng.sample(); final double expected = utilizationModel.getUtilizationHistory(time); assertEquals(expected, utilizationModel.getUtilization(time), "Utilization for time " + time); } }