@Test public void testOverbooking() { Cargo cargo1 = newCargo(100); Cargo cargo2 = newCargo(9); int code = shippingService.makeBooking(cargo1, voyage); assertEquals(0, code); code = shippingService.makeBooking(cargo2, voyage); assertEquals(-1, code); }
@Test public void testTooMuch() { Cargo cargo1 = newCargo(40); Cargo cargo2 = newCargo(40); Cargo cargo3 = newCargo(31); int code = shippingService.makeBooking(cargo1, voyage); assertEquals(0, code); code = shippingService.makeBooking(cargo2, voyage); assertEquals(1, code); code = shippingService.makeBooking(cargo3, voyage); assertEquals(-1, code); }
@Test public void testOrdinaryBooking() { Cargo cargo1 = newCargo(40); Cargo cargo2 = newCargo(40); Cargo cargo3 = newCargo(20); int code = shippingService.makeBooking(cargo1, voyage); assertEquals(0, code); code = shippingService.makeBooking(cargo2, voyage); assertEquals(1, code); code = shippingService.makeBooking(cargo3, voyage); assertEquals(2, code); }