UtilizationModelStochastic implements UtilizationModel { @Override public double getUtilization(double time) { if (getHistory().containsKey(time)) { return getHistory().get(time); } double utilization = getRandomGenerator().nextDouble(); getHistory().put(time, utilization); return utilization; } UtilizationModelStochastic();  UtilizationModelStochastic(long seed); @Override double getUtilization(double time); void saveHistory(String filename); @SuppressWarnings("unchecked") void loadHistory(String filename); void setRandomGenerator(Random randomGenerator); Random getRandomGenerator();  }
@Test public void testGetUtilization() { double utilization0 = utilizationModel.getUtilization(0); double utilization1 = utilizationModel.getUtilization(1); assertNotNull(utilization0); assertNotNull(utilization1); assertNotSame(utilization0, utilization1); assertEquals(utilization0, utilizationModel.getUtilization(0), 0); assertEquals(utilization1, utilizationModel.getUtilization(1), 0); }