AverageBelowTransform implements Transform { @Override public List<Metric> transform(QueryContext context, List<Metric> metrics) { throw new UnsupportedOperationException("This Transform cannot be used without a constant"); }  @Override List<Metric> transform(QueryContext context, List<Metric> metrics); @Override List<Metric> transform(QueryContext queryContext, List<Metric> metrics, List<String> constants); @Override String getResultScopeName(); @Override List<Metric> transform(QueryContext queryContext, List<Metric>... listOfList);  }
@Test public void testAverageBelowTransform() { Transform averageBelowTransform = new AverageBelowTransform(); Map<Long, Double> datapoints1 = new HashMap<Long, Double>(); datapoints1.put(1L, 1.0); datapoints1.put(2L, 2.0); datapoints1.put(3L, 3.0); datapoints1.put(4L, 4.0); Metric below = new Metric("below-scope", "below-metric"); below.setDatapoints(datapoints1); Map<Long, Double> datapoints2 = new HashMap<Long, Double>(); datapoints2.put(1L, 10.0); datapoints2.put(2L, 2.0); datapoints2.put(3L, 3.0); datapoints2.put(4L, 15.0); Metric above = new Metric("above-scope", "above-metric"); above.setDatapoints(datapoints2); List<Metric> metrics = new ArrayList<Metric>(); metrics.add(above); metrics.add(below); List<String> constants = new ArrayList<String>(1); constants.add("5"); List<Metric> result = averageBelowTransform.transform(null, metrics, constants); assertEquals(result.size(), 1); }