Change Code Without Fear
by Nada daVeiga

Listing One
/**
* Test for method: initOrder(com.ibatis.jpetstore.domain.Account,com.ibatis.jpetstore.domain.Cart)
*/
public void testInitOrder21() throws Throwable {
   Order testedObject = new Order();
   Account account = new Account();
   Cart cart = new Cart();
   account.setUsername("username1");
   account.setPassword("password0");
   account.setEmail("email0");
   account.setFirstName("firstName0");
   account.setLastName("lastName0");
   account.setStatus("status1");
   account.setAddress1("140 East 45th Street, New York, NY 10017");
   account.setAddress2("1600 Pennsylvania Avenue NW, Washington, DC 20500");
   account.setCity("Tokyo");
   account.setState("New York");
   account.setZip("90011-1234");
   account.setCountry("England");
   account.setPhone("1234567");
   account.setFavouriteCategoryId("favouriteCategoryId0");
   account.setLanguagePreference("languagePreference0");
   account.setListOption(false);
   account.setBannerOption(false);
   account.setBannerName("bannerName0");
   testedObject.initOrder(account, cart);
   assertNotNull(testedObject.getLineItems());
   assertEquals(0, testedObject.getLineItems().size());
   assertNotNull(testedObject.getOrderDate());
   assertEquals(new java.util.Date().toString(), testedObject.getOrderDate().toString());
   assertNotNull(testedObject.getTotalPrice());
   assertEquals("0", testedObject.getTotalPrice().toString()); 
   assertEquals("P", testedObject.getStatus());
   assertEquals(0, testedObject.getOrderId());
   assertEquals("username1", testedObject.getUsername());
   assertEquals("140 East 45th Street, New York, NY 10017", testedObject.getShipAddress1());
   assertEquals("1600 Pennsylvania Avenue NW, Washington, DC 20500",testedObject.getShipAddress2());
   assertNotNull(cart.getAllCartItems());
   assertNotNull(cart.getCartItems());
}

1


