WeightedTimeCostProvider implements CostProvider { @Override public long getCost(ProcessingDetails details) { assert weights != null : "Cost provider must be initialized before use"; long cost = 0; for (int i = 0; i < Timing.values().length; i++) { cost += details.get(Timing.values()[i]) * weights[i]; } return cost; }  @Override void init(String namespace, Configuration conf); @Override long getCost(ProcessingDetails details); static final String WEIGHT_CONFIG_PREFIX; }
@Test(expected = AssertionError.class) public void testGetCostBeforeInit() { costProvider.getCost(null); }