@Test public void GIVEN_populated_with_celsius_WHEN_fahrenheit_requested_THEN_returns_correct_value() { testee = new Temperature(new BigDecimal("-50.5")); new BigDecimalEquals().assertEquals(new BigDecimal("-58.9"), testee.getValue(TemperatureUnit.FAHRENHEIT)); testee = new Temperature(new BigDecimal("0")); new BigDecimalEquals().assertEquals(new BigDecimal("32"), testee.getValue(TemperatureUnit.FAHRENHEIT)); testee = new Temperature(new BigDecimal("50.5")); new BigDecimalEquals().assertEquals(new BigDecimal("122.9"), testee.getValue(TemperatureUnit.FAHRENHEIT)); }
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);  }