ReservationCostCalculator { public BigDecimal calculateRateFor(RoomEquipment roomEquipment, LocalDate checkin, LocalDate checkout) { long days = checkin.until(checkout, DAYS); BigDecimal rate = null; switch (roomEquipment) { case BUDGET: rate = BigDecimal.valueOf(60L); break; case STANDARD: rate = BigDecimal.valueOf(92L); break; case SUPERIOR: rate = BigDecimal.valueOf(210L); break; default: throw new IllegalArgumentException("Unknown equipment " + roomEquipment); } return rate.multiply(BigDecimal.valueOf(days)); }  BigDecimal calculateRateFor(RoomEquipment roomEquipment, LocalDate checkin, LocalDate checkout);  }
@Test public void calcRate() { LocalDate from = of(1976, SEPTEMBER, 8); LocalDate to = of(1976, SEPTEMBER, 12); BigDecimal rate = new ReservationCostCalculator().calculateRateFor(BUDGET, from, to); assertThat(rate).isEqualTo(BigDecimal.valueOf(240L)); }