コード例 #1
0
 @org.junit.Before
 public void setUp() throws Exception {
   hcontroller = new HotelController();
   hotel = hcontroller.getHotel("Hilton");
   book = new Booking();
   book.setEmail("*****@*****.**");
   book.setHotelId(hotel.getId());
   book.setRoomId(20);
   book.setPhoneNr("894-7896");
   book.setCreditCardNr("4567894512345698");
   book.setCustomerName("palli");
   book.setStartDate("2016-05-19");
   book.setEndDate("2016-05-20");
   book = bcontroller.saveBooking(book);
 }
コード例 #2
0
 @org.junit.Test
 public void testgetBookingsByCustomer() throws Exception {
   Booking[] pallibook = bcontroller.getBookingsByCustomer("palli");
   assertNotNull(pallibook);
   assertEquals(pallibook[0].getCustomerName(), "palli");
 }
コード例 #3
0
 @org.junit.Test
 public void testgetBookings() throws Exception {
   Booking[] bfylki = bcontroller.getBookings(hotel);
   assertNotNull(bfylki);
   assertEquals(bfylki[1].getId(), book.getId());
 }
コード例 #4
0
 @org.junit.Test
 public void testgetBooking() throws Exception {
   Booking btest = bcontroller.getBooking(book.getId());
   assertNotNull(btest);
   assertEquals(btest.getId(), book.getId());
 }
コード例 #5
0
 // ath hvort skili ekki error ef við setjum inn streng með tölum (aðferðin ætti að parsa það yfir
 // í int)
 @org.junit.Test
 public void testIntStringGetBooking() throws Exception {
   String id = "" + book.getId();
   testbooking = bcontroller.getBooking(id);
   assertEquals(testbooking.getId(), book.getId());
 }
コード例 #6
0
 // ath hvort skili error ef við setjum inn streng með táknum í getBooking
 @org.junit.Test(expected = IllegalArgumentException.class)
 public void testNoSpecialCharsGetBooking() throws Exception {
   testbooking = bcontroller.getBooking(Integer.parseInt(".-/"));
 }
コード例 #7
0
 @org.junit.After
 public void tearDown() throws Exception {
   bcontroller.deleteBooking(book.getId());
   bcontroller = null;
 }