@Test public void testGenericCostModel() { GenericCostModel gcm = new GenericCostModel(0.01); gcm.addTimeBoundary(new ResourceCostModel.TimeBoundary(5, 10, ResourceCostModel.TimeBoundary.SECONDS)); gcm.addTimeBoundary(new ResourceCostModel.TimeBoundary(5, 100, ResourceCostModel.TimeBoundary.MINUTES)); System.out.println("Testing " + gcm.getClass().getName() + "\n"); System.out.println(gcm.getDescription()); Assert.assertTrue("Cost per unit for 2 seconds should be 0.01", gcm.getCostPerUnit(twoSeconds)==0.01); Assert.assertTrue("Cost per unit for 6 minutes should be 1.0", gcm.getCostPerUnit(sixMinutes) == 1.0); Assert.assertTrue("Cost per unit for 2 hours should be 1.0", gcm.getCostPerUnit(twoHours) == 1.0); }
public GenericCostModel(double value) { this(value, null, DEFAULT_DESCRIPTION); }
GenericCostModel implements ResourceCostModel { public GenericCostModel(double value) { this(value, null, DEFAULT_DESCRIPTION); } }
GenericCostModel implements ResourceCostModel { public GenericCostModel(double value) { this(value, null, DEFAULT_DESCRIPTION); } GenericCostModel(double value);  GenericCostModel(double value, TimeBoundary[] timeBoundaries);  GenericCostModel(double value, 
                            TimeBoundary[] timeBoundaries, 
                            String description); }
GenericCostModel implements ResourceCostModel { public GenericCostModel(double value) { this(value, null, DEFAULT_DESCRIPTION); } GenericCostModel(double value);  GenericCostModel(double value, TimeBoundary[] timeBoundaries);  GenericCostModel(double value, 
                            TimeBoundary[] timeBoundaries, 
                            String description); double getCostPerUnit(long duration); void addTimeBoundary(TimeBoundary timeBoundary); String getDescription(); }
GenericCostModel implements ResourceCostModel { public GenericCostModel(double value) { this(value, null, DEFAULT_DESCRIPTION); } GenericCostModel(double value);  GenericCostModel(double value, TimeBoundary[] timeBoundaries);  GenericCostModel(double value, 
                            TimeBoundary[] timeBoundaries, 
                            String description); double getCostPerUnit(long duration); void addTimeBoundary(TimeBoundary timeBoundary); String getDescription();  }