### Question:
Value { public final double getValue() { if (count != 0) { return sum / (double) count; } if (hasInterpolated) { return interpolated; } return Double.NaN; }  final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final boolean valueIsInterpolated(); final void remove(final double value);  }### Answer:
@Test public void testGetValue() { Value victim = new Value(); double test = victim.getValue(); assertTrue("getValue() on an uninitialized value should return NaN.", Double.isNaN(test)); double val1 = 1.1, val2 = 2.0; victim.add(val1); assertEquals("Value with one entry should return that entry for getValue", val1, victim.getValue(), EPSILON); victim.add(val2); double expectedResult = (val1 + val2) / 2.0; assertEquals(String.format("Value with two entries should return the average of the entries for getValue (expected = %f, actual = %f", expectedResult, victim.getValue()), expectedResult,victim.getValue(), EPSILON); }
@Test public void uninitializedValueShouldReturnNaNOnGet() { Value victim = new Value(); assertTrue("An Uninitialized Value should return NaN on getValue().", Double.isNaN(victim.getValue())); }