@Test public void GIVEN_populated_with_millmetres_WHEN_millimetres_requested_THEN_returns_correct_value() { testee = new Rainfall(new BigDecimal("2.5")); new BigDecimalEquals().assertEquals(new BigDecimal("2.5"), testee.getValue(RainfallUnit.MILLIMETRES)); }
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);  }