示例#1
0
 @Test
 public void testGetBookedItineraries() {
   // test if all elements are itineraries
   boolean asserttest = false;
   for (int i = 0; i < c1.getBookedItineraries().size(); i++) {
     if (c1.getBookedItineraries().get(i) instanceof Itinerary) {
       asserttest = true;
     }
   }
 }
示例#2
0
  @Test
  public void testDisplaySortedItineraries() {
    // test if the returned ArrayList<Itinerary> actually returns a sorted ArrayList<Itinerary>
    boolean asserttest = false;
    assertEquals(c1.getFilter(), "cost");
    assertEquals(c1.getFilter(), "travel time");
    i = new ArrayList<Itinerary>();
    i.add(it1);
    i.add(it2);
    i.add(it3);

    if (c1.getFilter().equals("cost")) {
      for (int c = 0; c < (i.size() - 1); c++) {
        for (int d = 0; d < i.size() - c - 1; d++) {
          if (i.get(d).getTotalCost() > i.get(d + 1).getTotalCost()) {
            assertNotNull(it1);
            assertNotNull(it2);
            assertNotNull(it3);
            assertEquals(i.get(0), it1);
            assertEquals(i.get(1), it2);
            assertEquals(i.get(2), it3);
            Itinerary swap = i.get(d);
            assertEquals(i.get(d), it1);
            i.set(d, i.get(d + 1));
            assertNotNull(i.get(d));
            assertNotNull(i.get(d + 1));
            i.set(d + 1, swap);
          }
        }
      }
    } else {
      for (int j = 0; j < (i.size() - 1); j++) {
        for (int g = 0; g < i.size() - j - 1; g++) {
          if (i.get(g).getTotalTraveTime() > i.get(g + 1).getTotalTraveTime()) {
            assertNotNull(it1);
            assertNotNull(it2);
            assertNotNull(it3);
            assertEquals(i.get(0), it1);
            assertEquals(i.get(1), it2);
            assertEquals(i.get(2), it3);
            Itinerary swap = i.get(g);
            assertEquals(i.get(g), it1);
            i.set(g, i.get(g + 1));
            assertNotNull(i.get(g));
            assertNotNull(i.get(g + 1));
            i.set(g + 1, swap);
          }
        }
      }
      asserttest = true;
    }
  }
示例#3
0
 @Test
 public void testSetExpiryDate() {
   boolean asserttest = false;
   try {
     if (c1.getExpiryDate().length() > 10) {
       throw new InvalidInputException("Input exceeds required length");
     } else if (c1.getExpiryDate().length() < 10) {
       throw new InvalidInputException("Input is less than required length");
     } else if (c1.getExpiryDate().length() == 10) {
       // input is of type String assertEquals()
       asserttest = true;
     }
   } catch (InvalidInputException e) {
     // insert meaningful message
   }
 }
示例#4
0
  @Test
  public void testClient() {
    // checking if expirydate is valid
    try {
      if (c1.getExpiryDate().length() < 10) {
        throw new InvalidInputException("Input is less than required length");
      } else if (c1.getExpiryDate().length() > 10) {
        throw new InvalidInputException("Input is more than required length");
      } else if (c1.getExpiryDate().length() == 10) {
        // more shit

      }
    } catch (InvalidInputException e) {
      // insert meaningful message
    }
  }
示例#5
0
 @Test
 public void testSetFilter() {
   // test if the filter is a String
   boolean asserttest = false;
   if (c1.getFilter() instanceof String) {
     asserttest = false;
   }
 }
示例#6
0
 @Test
 public void testingEditClientInfoInt() {
   a1.editClientInfo(c3, "creditcardno", 246455554);
   assertEquals(246455554, c3.getCreditCardNumber());
 }
示例#7
0
 @Test
 public void testEditClientInfo() {
   // c1.setEmail("*****@*****.**");
   a1.editClientInfo(c1, "email", "*****@*****.**");
   assertEquals("*****@*****.**", c1.getEmail());
 }
示例#8
0
 @Test
 public void testGetExpiryDate() {
   assertEquals("2018-09-07", c1.getExpiryDate());
 }
示例#9
0
 @Test
 public void testGetFilter() {
   assertEquals("*****@*****.**", c1.getEmail());
 }
示例#10
0
  @Test
  public void testSetCreditCardNumber() {

    c1.setCreditCardNumber(1234123412341234L);
    assertEquals((1234123412341234L), c1.getCreditCardNumber());
  }
示例#11
0
  @Test
  public void testGetCreditCardNumber() {
    // c1.setEmail("");

    assertEquals((1234123412341234L), c1.getCreditCardNumber());
  }
示例#12
0
 @Test
 public void testSetAddress() {
   c1.setAddress("77 Huron St");
   assertEquals("77 Huron St", c1.getAddress());
 }
示例#13
0
 @Test
 public void testGetAddress() {
   // c1.setEmail("*****@*****.**");
   assertEquals("77 Huron St", c1.getAddress());
 }
示例#14
0
 @Test
 public void testSetEmail() {
   c1.setEmail("*****@*****.**");
   assertEquals("*****@*****.**", c1.getEmail());
 }