Exemplo n.º 1
0
  @Test
  @Ignore
  public void testMoreHutsPaidAndNew() {
    final int id1 =
        reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());
    reservationService.updateReservationState(ReservationState.PAID.name(), id1);
    entityManager.clear();

    final int id2 =
        reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());
    reservationService.updateReservationState(ReservationState.PAID.name(), id2);
    entityManager.clear();

    final int id3 =
        reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());
    reservationService.updateReservationState(ReservationState.PAID.name(), id3);
    entityManager.clear();

    final int id4 =
        reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());

    reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());
    //
    final List<Reservation> reservations = reservationRepository.findAll();

    assertNotNull(reservations);
    assertFalse(reservations.isEmpty());
    assertEquals(5, reservations.size());
  }
Exemplo n.º 2
0
  @Test(expected = RuntimeException.class)
  //    @Ignore("mails")
  public void testMoreHutsPaid() {
    final int id1 =
        reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());
    reservationService.updateReservationState(ReservationState.PAID.name(), id1);
    entityManager.clear();

    final int id2 =
        reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());
    reservationService.updateReservationState(ReservationState.PAID.name(), id2);
    entityManager.clear();

    final int id3 =
        reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());
    reservationService.updateReservationState(ReservationState.PAID.name(), id3);
    entityManager.clear();

    final int id4 =
        reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());
    reservationService.updateReservationState(ReservationState.PAID.name(), id4);
    entityManager.clear();

    reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());
  }
Exemplo n.º 3
0
  @Test
  @Ignore
  public void testMoreHutsNew() {
    reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());
    reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());
    reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());
    reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());
    reservationService.createReservationAdmin(ReservationModelUtils.createReservationModel());

    final List<Reservation> reservations = reservationRepository.findAll();

    assertNotNull(reservations);
    assertFalse(reservations.isEmpty());
    assertEquals(5, reservations.size());
  }
Exemplo n.º 4
0
  @Test
  public void getReservation() {

    List<HutOccupationModel> reservation =
        reservationService.getOccupation(
            new DateTime(2015, 10, 1, 0, 0, 0), new DateTime(2015, 10, 10, 0, 0, 0));

    assert reservation.size() == 10;
    for (HutOccupationModel reservationModel : reservation) {
      assert reservationModel.getHuts().isEmpty();
    }

    ReservationModel model =
        ReservationModelUtils.createReservationModel(
            new DateTime(2015, 10, 2, 0, 0, 0), new DateTime(2015, 10, 4, 0, 0, 0));

    reservationService.createReservationAdmin(model);

    reservation =
        reservationService.getOccupation(
            new DateTime(2015, 10, 1, 0, 0, 0), new DateTime(2015, 10, 10, 0, 0, 0));

    assert reservation.size() == 10;
    int reservedDays = 0;
    for (HutOccupationModel reservationModel : reservation) {
      if (!reservationModel.getHuts().isEmpty()) reservedDays++;
    }

    assert reservedDays == 3;
  }
Exemplo n.º 5
0
  @Test
  @Ignore("mails")
  public void updateStateTest() {

    ReservationModel model = ReservationModelUtils.createReservationModel();

    Integer id = reservationService.createReservationAdmin(model);

    reservationService.updateReservationState(ReservationState.CONFIRM.name(), id);

    entityManager.clear();

    Reservation reservation = reservationRepository.findOne(id);

    assert Objects.equals(reservation.getId(), id);
    assert reservation.getState().equals(ReservationState.CONFIRM.name());
  }
Exemplo n.º 6
0
 @Test
 public void createReservationAdminTest() {
   final ReservationModel reservationModel = ReservationModelUtils.createReservationModel();
   final Integer id = reservationService.createReservationAdmin(reservationModel);
   assert id != 0;
 }