orderManager.saveOrder(order);
}
@Test
public void insertOrder() throws Exception {
Order order = new Order();
orders.add(order);
Customer customer = new Customer();
customers.add(customer);
customer.setCustomerNr(100);
customer.setFirstName("Atle");
customer.setLastName("Brekka");
customerManager.saveCustomer(customer);
productArea = new ProductArea(null, "test", null, null, null, null,
null);
productAreaManager.saveProductArea(productArea);
ConstructionType constructionType = new ConstructionType();
constructionTypes.add(constructionType);
constructionType.setName("Q5");
constructionType.setProductArea(productArea);
constructionTypeManager.saveConstructionType(constructionType);
order.setOrderNr("test");
order.setCustomer(customer);
order.setConstructionType(constructionType);
order.setDeliveryAddress("testing");
order.setPostalCode("0354");
order.setPostOffice("Oslo");
order.setOrderDate(Calendar.getInstance().getTime());
order.setProductArea(productArea);
ArticleType articleType = new ArticleType(null, "test", null, null,
null, null, null, null, null, null, null, null);
articleTypes.add(articleType);
articleTypeManager.saveArticleType(articleType);
OrderLine orderLine = new OrderLine(null, order, null, articleType,
null, null, null, null, null, null, "test", null, null, null,
null, null, null, null, null, null, null, null);
Set<OrderLine> orderLines = new HashSet<OrderLine>();
orderLines.add(orderLine);
order.setOrderLines(orderLines);
orderManager.saveOrder(order);
order = orderManager.findByOrderNr("1");
assertNotNull(order);
assertEquals("1", order.getOrderNr());
assertNotNull(order.getOrderId());
}