@Test public void automaticAddTest() { assertThat(reservationService.findAll()).isEmpty(); reservationService.automaticAdd(); List<Reservation> reservations = reservationService.findAll(); assertThat(reservations.size()).isEqualTo(1); assertThat(reservations.get(0).getJour()).isEqualTo(new LocalDate().plusWeeks(1)); }
@Test public void findAllAndAddIfNeededTest() { assertThat(reservationService.findAll()).isEmpty(); List<Reservation> reservations = reservationService.findAllAndAddIfNeeded(); assertThat(reservations.size()).isEqualTo(2); Object[] resaDays = {DateTimeConstants.THURSDAY, DateTimeConstants.TUESDAY}; assertThat(reservations.get(0).getJour().getDayOfWeek()).isIn(resaDays); assertThat(reservations.get(1).getJour().getDayOfWeek()).isIn(resaDays); assertThat(reservations.get(0).getJour()).isNotEqualTo(reservations.get(1).getJour()); reservations = reservationService.findAll(); assertThat(reservations.size()).isEqualTo(2); }