@Test public void GIVEN_populated_with_celsius_WHEN_celsius_requested_THEN_returns_correct_value() { testee = new Temperature(new BigDecimal("25.5")); assertEquals(new BigDecimal("25.5"), testee.getValue(TemperatureUnit.CELSIUS)); }
public BigDecimal getValue(TemperatureUnit unit) { BigDecimal value = null; switch (unit) { case CELSIUS: value = celsius; break; case FAHRENHEIT: value = fahrenheit; break; } return value; }
Temperature { public BigDecimal getValue(TemperatureUnit unit) { BigDecimal value = null; switch (unit) { case CELSIUS: value = celsius; break; case FAHRENHEIT: value = fahrenheit; break; } return value; } }
Temperature { public BigDecimal getValue(TemperatureUnit unit) { BigDecimal value = null; switch (unit) { case CELSIUS: value = celsius; break; case FAHRENHEIT: value = fahrenheit; break; } return value; } Temperature(BigDecimal celsius); }
Temperature { public BigDecimal getValue(TemperatureUnit unit) { BigDecimal value = null; switch (unit) { case CELSIUS: value = celsius; break; case FAHRENHEIT: value = fahrenheit; break; } return value; } Temperature(BigDecimal celsius); BigDecimal getValue(TemperatureUnit unit); }
Temperature { public BigDecimal getValue(TemperatureUnit unit) { BigDecimal value = null; switch (unit) { case CELSIUS: value = celsius; break; case FAHRENHEIT: value = fahrenheit; break; } return value; } Temperature(BigDecimal celsius); BigDecimal getValue(TemperatureUnit unit);  }