Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import base.Address;
- import base.Customer;
- import base.Person;
- import order.base.OrderStatus;
- import order.exceptions.ContainerException;
- import order.exceptions.OrderException;
- import order.exceptions.PositionException;
- import order.shippingorder.ShippingOrder;
- import org.junit.jupiter.api.Test;
- import packing.Container;
- import static order.base.OrderStatus.IN_TREATMENT;
- import static org.junit.jupiter.api.Assertions.*;
- public class testMain {
- @Test
- void testSO001(){
- Address a = new Address("street", 1, "city", "state", "country");
- Person p = new Person("Name", a);
- Person p2 = new Person("Name2", a);
- Customer c = new Customer("Name", a, a);
- ShippingOrder so = new ShippingOrder(c,p2);
- Container c1 = null;
- assertThrows(ContainerException.class,
- () ->so.addContainer(c1),
- "Didn't throw ContainerException as supposed");
- }
- @Test
- void testSO002() throws ContainerException, PositionException, OrderException {
- Address a = new Address("street", 1, "city", "state", "country");
- Person p = new Person("Name", a);
- Person p2 = new Person("Name2", a);
- Customer c = new Customer("Name", a, a);
- ShippingOrder so = new ShippingOrder(c,p2);
- Container c1 = new Container("001", 10, 10, 10, 10);
- assertThrows(OrderException.class,
- () ->so.addContainer(c1),
- "Didn't throw OrderException as supposed");
- }
- @Test
- void testSO003() throws ContainerException, PositionException, OrderException{
- Address a = new Address("street", 1, "city", "state", "country");
- Person p = new Person("Name", a);
- Person p2 = new Person("Name2", a);
- Customer c = new Customer("Name", a, a);
- ShippingOrder so = new ShippingOrder(c,p2);
- Container c1 = new Container("001", 10, 10, 10, 10);
- c1.close();
- boolean result = so.addContainer(c1);
- assertTrue(result);
- }
- @Test
- void testSO004() throws ContainerException, PositionException, OrderException{
- Address a = new Address("street", 1, "city", "state", "country");
- Person p = new Person("Name", a);
- Person p2 = new Person("Name2", a);
- Customer c = new Customer("Name", a, a);
- ShippingOrder so = new ShippingOrder(c,p2);
- Container c1 = new Container("001", 10, 10, 10, 10);
- c1.close();
- so.addContainer(c1);
- boolean result = so.addContainer(c1);
- assertFalse(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment