@Test public void GIVEN_populated_with_knots_between_3_point_5_and_6_point_4_WHEN_get_beaufort_scale_requested_THEN_returns_2() { testee = new WindSpeed(new BigDecimal("3.5")); new BigDecimalEquals().assertEquals(new BigDecimal("2"), testee.getValue(WindSpeedUnit.BEAUFORT_SCALE)); testee = new WindSpeed(new BigDecimal("6.4")); new BigDecimalEquals().assertEquals(new BigDecimal("2"), testee.getValue(WindSpeedUnit.BEAUFORT_SCALE)); }
public BigDecimal getValue(WindSpeedUnit unit) { BigDecimal value = null; switch (unit) { case KNOTS: value = knots; break; case METRES_PER_SECOND: value = metresPerSecond; break; case KILOMETRES_PER_HOUR: value = kilometresPerHour; break; case MILES_PER_HOUR: value = milesPerHour; break; case BEAUFORT_SCALE: value = beaufortScale; break; } return value; }
WindSpeed { public BigDecimal getValue(WindSpeedUnit unit) { BigDecimal value = null; switch (unit) { case KNOTS: value = knots; break; case METRES_PER_SECOND: value = metresPerSecond; break; case KILOMETRES_PER_HOUR: value = kilometresPerHour; break; case MILES_PER_HOUR: value = milesPerHour; break; case BEAUFORT_SCALE: value = beaufortScale; break; } return value; } }
WindSpeed { public BigDecimal getValue(WindSpeedUnit unit) { BigDecimal value = null; switch (unit) { case KNOTS: value = knots; break; case METRES_PER_SECOND: value = metresPerSecond; break; case KILOMETRES_PER_HOUR: value = kilometresPerHour; break; case MILES_PER_HOUR: value = milesPerHour; break; case BEAUFORT_SCALE: value = beaufortScale; break; } return value; } WindSpeed(BigDecimal knots); }
WindSpeed { public BigDecimal getValue(WindSpeedUnit unit) { BigDecimal value = null; switch (unit) { case KNOTS: value = knots; break; case METRES_PER_SECOND: value = metresPerSecond; break; case KILOMETRES_PER_HOUR: value = kilometresPerHour; break; case MILES_PER_HOUR: value = milesPerHour; break; case BEAUFORT_SCALE: value = beaufortScale; break; } return value; } WindSpeed(BigDecimal knots); BigDecimal getValue(WindSpeedUnit unit); }
WindSpeed { public BigDecimal getValue(WindSpeedUnit unit) { BigDecimal value = null; switch (unit) { case KNOTS: value = knots; break; case METRES_PER_SECOND: value = metresPerSecond; break; case KILOMETRES_PER_HOUR: value = kilometresPerHour; break; case MILES_PER_HOUR: value = milesPerHour; break; case BEAUFORT_SCALE: value = beaufortScale; break; } return value; } WindSpeed(BigDecimal knots); BigDecimal getValue(WindSpeedUnit unit);  }