@Test public void get_all_reservations_returns_the_reservations() { List<Reservation> allReservations = bookingService.getAllReservations(); assertThat(allReservations).isNotNull(); }
public List<Reservation> getAllReservations() { CriteriaQuery<Reservation> cq = this.em.getCriteriaBuilder().createQuery(Reservation.class); cq.select(cq.from(Reservation.class)); return new ArrayList<>(this.em.createQuery(cq).getResultList()); }
BookingService { public List<Reservation> getAllReservations() { CriteriaQuery<Reservation> cq = this.em.getCriteriaBuilder().createQuery(Reservation.class); cq.select(cq.from(Reservation.class)); return new ArrayList<>(this.em.createQuery(cq).getResultList()); } }
BookingService { public List<Reservation> getAllReservations() { CriteriaQuery<Reservation> cq = this.em.getCriteriaBuilder().createQuery(Reservation.class); cq.select(cq.from(Reservation.class)); return new ArrayList<>(this.em.createQuery(cq).getResultList()); } BookingService(); @Inject  BookingService(Event<NewReservationEvent> reservationEvents, Event<ReservationStatusChangeEvent> reservationStateChangeEvents, ReservationCostCalculator reservationCostCalculator); }
BookingService { public List<Reservation> getAllReservations() { CriteriaQuery<Reservation> cq = this.em.getCriteriaBuilder().createQuery(Reservation.class); cq.select(cq.from(Reservation.class)); return new ArrayList<>(this.em.createQuery(cq).getResultList()); } BookingService(); @Inject  BookingService(Event<NewReservationEvent> reservationEvents, Event<ReservationStatusChangeEvent> reservationStateChangeEvents, ReservationCostCalculator reservationCostCalculator); void setReservationStateChangeEvents(Event<ReservationStatusChangeEvent> reservationStateChangeEvents); void setReservationEvents(Event<NewReservationEvent> reservationEvents); boolean cancelReservation(String reservationNumber); String newReservationNumber(); List<Reservation> findReservationForGuest(String guestId); List<Reservation> getAllReservations(); Reservation getReservation(Long id); Reservation bookRoom(String guestId, String roomId, LocalDate checkin, LocalDate checkout); @PersistenceContext void setEntityManager(EntityManager entityManager); Optional<Reservation> findReservationByNumber(String reservationNumber); void reopenReservation(String reservationNumber); void confirmReservation(String reservationNumber); }
BookingService { public List<Reservation> getAllReservations() { CriteriaQuery<Reservation> cq = this.em.getCriteriaBuilder().createQuery(Reservation.class); cq.select(cq.from(Reservation.class)); return new ArrayList<>(this.em.createQuery(cq).getResultList()); } BookingService(); @Inject  BookingService(Event<NewReservationEvent> reservationEvents, Event<ReservationStatusChangeEvent> reservationStateChangeEvents, ReservationCostCalculator reservationCostCalculator); void setReservationStateChangeEvents(Event<ReservationStatusChangeEvent> reservationStateChangeEvents); void setReservationEvents(Event<NewReservationEvent> reservationEvents); boolean cancelReservation(String reservationNumber); String newReservationNumber(); List<Reservation> findReservationForGuest(String guestId); List<Reservation> getAllReservations(); Reservation getReservation(Long id); Reservation bookRoom(String guestId, String roomId, LocalDate checkin, LocalDate checkout); @PersistenceContext void setEntityManager(EntityManager entityManager); Optional<Reservation> findReservationByNumber(String reservationNumber); void reopenReservation(String reservationNumber); void confirmReservation(String reservationNumber);  }