### Question:
MADFunction extends AggregateFunction<JsonNode, Double> { @Override public Double compute() { if (values.isEmpty()) { return Double.NaN; } return mad(); }  @Override AggregateFunction addValue(JsonNode value); @Override Double compute(); @Override AggregateFunction<JsonNode, Double> merge(AggregateFunction<JsonNode, Double> newValue);  }### Answer:
@Test public void shouldReturnNanIfNoResult() { MADFunction madFunction = new MADFunction(); assertThat(madFunction.compute()).isEqualTo(Double.NaN); }