@Test(expected = EanWsError.class) public void testCancellationInvalidConfirmationNumber() throws Exception { Reservation testReservation = BookingRequestIntTest.getTestReservation(); CancellationRequest cancellationRequest = new CancellationRequest(testReservation.itineraryId, -1L, EMAIL, null); RequestProcessor.run(cancellationRequest); }
@Override protected com.ean.mobile.hotel.HotelInformation doInBackground(final Void... voids) { try { return RequestProcessor.run(new InformationRequest(hotelId)); } catch (EanWsError ewe) { Log.d(SampleConstants.LOG_TAG, "Unexpected error occurred within the api", ewe); } catch (UrlRedirectionException ure) { SampleApp.sendRedirectionToast(getApplicationContext()); } return null; }
@Test(expected = EanWsError.class) public void testCancellationInvalidEmail() throws Exception { Reservation testReservation = BookingRequestIntTest.getTestReservation(); CancellationRequest cancellationRequest = new CancellationRequest( testReservation.itineraryId, testReservation.confirmationNumbers.get(0), "*****@*****.**", null); RequestProcessor.run(cancellationRequest); }
@Override protected List<HotelRoom> doInBackground(final Void... voids) { try { final RoomAvailabilityRequest request = new RoomAvailabilityRequest(hotelId, SampleApp.occupancy(), arrivalDate, departureDate); return RequestProcessor.run(request); } catch (EanWsError ewe) { Log.d(SampleConstants.LOG_TAG, "An error occurred in the api", ewe); } catch (UrlRedirectionException ure) { SampleApp.sendRedirectionToast(getApplicationContext()); } return null; }
@Ignore( "Will never pass because test cancellations always return an EanWsError. It is here only for reference.") @Test public void testCancellationValid() throws Exception { Reservation testReservation = BookingRequestIntTest.getTestReservation(); CancellationRequest cancellationRequest = new CancellationRequest( testReservation.itineraryId, testReservation.confirmationNumbers.get(0), EMAIL, null); Cancellation cancellation = RequestProcessor.run(cancellationRequest); assertNotNull(cancellation); assertThat(cancellation.cancellationNumber, not(isEmptyOrNullString())); }
@Test(expected = EanWsError.class) public void testCancellationInvalidItineraryIdEmailConfirmationNumber() throws Exception { CancellationRequest cancellationRequest = new CancellationRequest(-1L, -1L, null, null); RequestProcessor.run(cancellationRequest); }