Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- import static org.junit.Assert.assertEquals;
- import static org.junit.Assert.fail;
- import org.junit.Test;
- import com.tddair.Flight;
- public class TestFlightExceptions {
- @Test
- public void testNullOrigin() {
- try {
- new Flight(null, "ORD", 900, "AA", 1720);
- fail("Should throw IlegalArgumentException!");
- } catch (Exception e) {
- assertEquals("Invalid origin code", e.getMessage());
- }
- }
- @Test(expected = IllegalArgumentException.class)
- public void testNullDestination() {
- new Flight("DFW", null, 900, "AA", 1720);
- }
- }
Add Comment
Please, Sign In to add comment