Guest User

Untitled

a guest
Oct 18th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. package test;
  2.  
  3. import static org.junit.Assert.assertEquals;
  4. import static org.junit.Assert.fail;
  5.  
  6. import org.junit.Test;
  7.  
  8. import com.tddair.Flight;
  9.  
  10. public class TestFlightExceptions {
  11.  
  12. @Test
  13. public void testNullOrigin() {
  14. try {
  15. new Flight(null, "ORD", 900, "AA", 1720);
  16. fail("Should throw IlegalArgumentException!");
  17. } catch (Exception e) {
  18. assertEquals("Invalid origin code", e.getMessage());
  19. }
  20. }
  21.  
  22. @Test(expected = IllegalArgumentException.class)
  23. public void testNullDestination() {
  24. new Flight("DFW", null, 900, "AA", 1720);
  25. }
  26. }
Add Comment
Please, Sign In to add comment