@Test public void testList01() { TourInfo tour1 = new TourInfo("01"); TourInfo tour2 = new TourInfo("02"); Reserve reserve1 = new Reserve("001"); Reserve reserve2 = new Reserve("002"); reserve1.setTourInfo(tour1); reserve2.setTourInfo(tour2); tour1.setTourDays(2); tour2.setTourDays(4); List<Reserve> reserves = Arrays.asList(reserve1, reserve2); when(reserveService.findAllByCustomerCode("xxxx")).thenReturn(reserves); when(tourInfoSharedService.isOverPaymentLimit(tour1)).thenReturn(false); when(tourInfoSharedService.isOverPaymentLimit(tour2)).thenReturn(true); List<ReserveRowOutput> result = manageReservationFacade.list( userDetails); assertThat(result, is(notNullValue())); assertThat(result.size(), is(2)); ReserveRowOutput o1 = result.get(0); assertThat(o1.getLimitExceeding(), is(false)); assertThat(o1.getReserve(), is(reserve1)); assertThat(o1.getTourDays(), is("2")); ReserveRowOutput o2 = result.get(1); assertThat(o2.getLimitExceeding(), is(true)); assertThat(o2.getReserve(), is(reserve2)); assertThat(o2.getTourDays(), is("4")); }
public List<ReserveRowOutput> list(ReservationUserDetails userDetails) { String customerCode = userDetails.getUsername(); List<Reserve> reserves = reserveService.findAllByCustomerCode( customerCode); List<ReserveRowOutput> rows = new ArrayList<ReserveRowOutput>(); for (Reserve reservation : reserves) { ReserveRowOutput reservationRowOutput = new ReserveRowOutput(); TourInfo tourInfo = reservation.getTourInfo(); reservationRowOutput.setLimitExceeding(tourInfoSharedService .isOverPaymentLimit(tourInfo)); reservationRowOutput.setTourDays(tourInfo.getTourDays() + ""); reservationRowOutput.setReserve(reservation); rows.add(reservationRowOutput); } return rows; }
ManageReservationHelper { public List<ReserveRowOutput> list(ReservationUserDetails userDetails) { String customerCode = userDetails.getUsername(); List<Reserve> reserves = reserveService.findAllByCustomerCode( customerCode); List<ReserveRowOutput> rows = new ArrayList<ReserveRowOutput>(); for (Reserve reservation : reserves) { ReserveRowOutput reservationRowOutput = new ReserveRowOutput(); TourInfo tourInfo = reservation.getTourInfo(); reservationRowOutput.setLimitExceeding(tourInfoSharedService .isOverPaymentLimit(tourInfo)); reservationRowOutput.setTourDays(tourInfo.getTourDays() + ""); reservationRowOutput.setReserve(reservation); rows.add(reservationRowOutput); } return rows; } }
ManageReservationHelper { public List<ReserveRowOutput> list(ReservationUserDetails userDetails) { String customerCode = userDetails.getUsername(); List<Reserve> reserves = reserveService.findAllByCustomerCode( customerCode); List<ReserveRowOutput> rows = new ArrayList<ReserveRowOutput>(); for (Reserve reservation : reserves) { ReserveRowOutput reservationRowOutput = new ReserveRowOutput(); TourInfo tourInfo = reservation.getTourInfo(); reservationRowOutput.setLimitExceeding(tourInfoSharedService .isOverPaymentLimit(tourInfo)); reservationRowOutput.setTourDays(tourInfo.getTourDays() + ""); reservationRowOutput.setReserve(reservation); rows.add(reservationRowOutput); } return rows; }  }
ManageReservationHelper { public List<ReserveRowOutput> list(ReservationUserDetails userDetails) { String customerCode = userDetails.getUsername(); List<Reserve> reserves = reserveService.findAllByCustomerCode( customerCode); List<ReserveRowOutput> rows = new ArrayList<ReserveRowOutput>(); for (Reserve reservation : reserves) { ReserveRowOutput reservationRowOutput = new ReserveRowOutput(); TourInfo tourInfo = reservation.getTourInfo(); reservationRowOutput.setLimitExceeding(tourInfoSharedService .isOverPaymentLimit(tourInfo)); reservationRowOutput.setTourDays(tourInfo.getTourDays() + ""); reservationRowOutput.setReserve(reservation); rows.add(reservationRowOutput); } return rows; }  List<ReserveRowOutput> list(ReservationUserDetails userDetails); ReservationDetailOutput findDetail(String reserveNo); ReservationDetailOutput findDetail(String reserveNo,
            ManageReservationForm form); DownloadPDFOutput createPDF(String reserveNo, Locale locale); }
ManageReservationHelper { public List<ReserveRowOutput> list(ReservationUserDetails userDetails) { String customerCode = userDetails.getUsername(); List<Reserve> reserves = reserveService.findAllByCustomerCode( customerCode); List<ReserveRowOutput> rows = new ArrayList<ReserveRowOutput>(); for (Reserve reservation : reserves) { ReserveRowOutput reservationRowOutput = new ReserveRowOutput(); TourInfo tourInfo = reservation.getTourInfo(); reservationRowOutput.setLimitExceeding(tourInfoSharedService .isOverPaymentLimit(tourInfo)); reservationRowOutput.setTourDays(tourInfo.getTourDays() + ""); reservationRowOutput.setReserve(reservation); rows.add(reservationRowOutput); } return rows; }  List<ReserveRowOutput> list(ReservationUserDetails userDetails); ReservationDetailOutput findDetail(String reserveNo); ReservationDetailOutput findDetail(String reserveNo,
            ManageReservationForm form); DownloadPDFOutput createPDF(String reserveNo, Locale locale);  }