예제 #1
0
 @Test
 /** Tests that reserveGroup() reserves the correct seats when called on an empty plane. */
 public void testReserveGroupOnEmptyPlane() throws NotEnoughSeatsException {
   AirplaneSeats seats = new AirplaneSeats(3, 4);
   ArrayList<String> test = new ArrayList<String>();
   test.add("A1");
   test.add("B1");
   test.add("C1");
   ArrayList<String> group = seats.reserveGroup(3);
   Assert.assertSame(test, group);
 }
예제 #2
0
 @Test
 /**
  * Tests that reserveGroup() reserves the correct seats when called on a plane that has seats
  * already reserved. For instance, on a 3,4 airplane whose "A1" is occupied, calling
  * reserveGroup(4) should return a list of elements ["A2", "B2", "C2", "D2"]
  */
 public void testReserveGroupOnPartiallyFilledPlane()
     throws NotEnoughSeatsException, AlreadyReservedException, SeatOutOfBoundsException {
   AirplaneSeats seats = new AirplaneSeats(3, 4);
   seats.reserve("A1");
   seats.reserve("C1");
   seats.reserve("B2");
   seats.reserve("A3");
   ArrayList<String> test = new ArrayList<String>();
   test.add("B3");
   test.add("C3");
   test.add("D3");
   ArrayList<String> group = seats.reserveGroup(3);
   Assert.assertSame(test, group);
 }