@Test public void GIVEN_populated_with_millmetres_WHEN_inches_requested_THEN_returns_correct_value() { testee = new Rainfall(new BigDecimal("0")); new BigDecimalEquals().assertEquals(new BigDecimal("0"), testee.getValue(RainfallUnit.INCHES)); testee = new Rainfall(new BigDecimal("10")); new BigDecimalEquals().assertEquals(new BigDecimal("0.39370080"), testee.getValue(RainfallUnit.INCHES)); testee = new Rainfall(new BigDecimal("50")); new BigDecimalEquals().assertEquals(new BigDecimal("1.96850400"), testee.getValue(RainfallUnit.INCHES)); }
public BigDecimal getValue(RainfallUnit unit) { BigDecimal value = null; switch (unit) { case MILLIMETRES: value = millimetres; break; case INCHES: value = inches; break; } return value; }
Rainfall { public BigDecimal getValue(RainfallUnit unit) { BigDecimal value = null; switch (unit) { case MILLIMETRES: value = millimetres; break; case INCHES: value = inches; break; } return value; } }
Rainfall { public BigDecimal getValue(RainfallUnit unit) { BigDecimal value = null; switch (unit) { case MILLIMETRES: value = millimetres; break; case INCHES: value = inches; break; } return value; } Rainfall(BigDecimal millimetres); }
Rainfall { public BigDecimal getValue(RainfallUnit unit) { BigDecimal value = null; switch (unit) { case MILLIMETRES: value = millimetres; break; case INCHES: value = inches; break; } return value; } Rainfall(BigDecimal millimetres); BigDecimal getValue(RainfallUnit unit); }
Rainfall { public BigDecimal getValue(RainfallUnit unit) { BigDecimal value = null; switch (unit) { case MILLIMETRES: value = millimetres; break; case INCHES: value = inches; break; } return value; } Rainfall(BigDecimal millimetres); BigDecimal getValue(RainfallUnit unit);  }