private CancelHotelRequestType getCancelRequest(int i) { CancelHotelRequestType r = new CancelHotelRequestType(); r.setBookingNumber(i); return r; }
@Test public void testCancelHotel() { DatatypeFactory df = new DatatypeFactoryImpl(); CreditCardInfoType c = getCreditCardType( 50408816, df.newXMLGregorianCalendarDate(2009, 5, 1, 0), "Anne Strandberg"); BookHotelRequestType breq; String str; CancelHotelRequestType creq; String ok = "all ok"; String no = "all ok. no hotels to cancel"; try { try { creq = null; cancelHotel(creq); fail("Oh noes"); } catch (CancelHotelFault e) { Logger.getLogger(NiceViewTest.class.getName()).log(Level.SEVERE, null, e); } breq = getBookRequest(1000000, c); bookHotel(breq); creq = getCancelRequest(1000000); str = cancelHotel(creq); assertEquals(str, ok); creq.setBookingNumber(5); str = cancelHotel(creq); assertEquals(str, no); } catch (CancelHotelFault e) { Logger.getLogger(NiceViewTest.class.getName()).log(Level.SEVERE, null, e); } catch (BookHotelFault e) { Logger.getLogger(NiceViewTest.class.getName()).log(Level.SEVERE, null, e); } }