// Path: anemic-vs-rich-domain-model/src/main/java/com/link_intersystems/blog/model/anemic/Order.java
// public class Order {
// 
// 	private BigDecimal total = BigDecimal.ZERO;
// 
// 	private List<OrderItem> items = new ArrayList<OrderItem>();
// 
// 	public BigDecimal getTotal() {
// 		return total;
// 	}
// 
// 	public void setTotal(BigDecimal total) {
// 		this.total = total;
// 	}
// 
// 	public List<OrderItem> getItems() {
// 		return items;
// 	}
// 
// 	public void setItems(List<OrderItem> items) {
// 		this.items = items;
// 	}
// 
// }
// 
// Path: anemic-vs-rich-domain-model/src/main/java/com/link_intersystems/blog/model/anemic/OrderItem.java
// public class OrderItem {
// 
// 	private BigDecimal price;
// 
// 	private int quantity;
// 
// 	private String name;
// 
// 	public BigDecimal getPrice() {
// 		return price;
// 	}
// 
// 	public void setPrice(BigDecimal price) {
// 		this.price = price;
// 	}
// 
// 	public int getQuantity() {
// 		return quantity;
// 	}
// 
// 	public void setQuantity(int quantity) {
// 		this.quantity = quantity;
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// }
// 
// Path: anemic-vs-rich-domain-model/src/main/java/com/link_intersystems/blog/model/anemic/OrderService.java
// public class OrderService {
// 
// 	public void calculateTotal(Order order) {
// 		if (order == null) {
// 			throw new IllegalArgumentException("order must not be null");
// 		}
// 
// 		BigDecimal total = BigDecimal.ZERO;
// 		List<OrderItem> items = order.getItems();
// 
// 		for (OrderItem orderItem : items) {
// 			int quantity = orderItem.getQuantity();
// 			BigDecimal price = orderItem.getPrice();
// 			BigDecimal itemTotal = price.multiply(new BigDecimal(quantity));
// 			total = total.add(itemTotal);
// 		}
// 		order.setTotal(total);
// 	}
// }


import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import java.math.BigDecimal;
import org.junit.Test;
import com.link_intersystems.blog.model.anemic.Order;
import com.link_intersystems.blog.model.anemic.OrderItem;
import com.link_intersystems.blog.model.anemic.OrderService;
package com.link_intersystems.blog.model.anemic;





public class OrderTest {

	/**
	 * This test shows that an anemic model can be in an inconsistent state,
	 * because it doesn't handle it's state changes. So an anemic model can
	 * never guarantee that it is in a legal state. State handling of an anemic
	 * model is placed outside that object in classes mostly named "Service",
	 * "Helper", "Util", "Manager" etc.
	 * <p>
	 * <blockquote> The problem with an anemic model is that a client must know
	 * in which state the object it uses is and which service methods it has to
	 * call if it changes the state of an anemic model to keep the object in a
	 * legal state. </blockquote>
	 * </p>
	 */
	@Test
	public void anAnemicModelCanBeInconsistent() {
// Path: anemic-vs-rich-domain-model/src/main/java/com/link_intersystems/blog/model/anemic/Order.java
// public class Order {
// 
// 	private BigDecimal total = BigDecimal.ZERO;
// 
// 	private List<OrderItem> items = new ArrayList<OrderItem>();
// 
// 	public BigDecimal getTotal() {
// 		return total;
// 	}
// 
// 	public void setTotal(BigDecimal total) {
// 		this.total = total;
// 	}
// 
// 	public List<OrderItem> getItems() {
// 		return items;
// 	}
// 
// 	public void setItems(List<OrderItem> items) {
// 		this.items = items;
// 	}
// 
// }
// 
// Path: anemic-vs-rich-domain-model/src/main/java/com/link_intersystems/blog/model/anemic/OrderItem.java
// public class OrderItem {
// 
// 	private BigDecimal price;
// 
// 	private int quantity;
// 
// 	private String name;
// 
// 	public BigDecimal getPrice() {
// 		return price;
// 	}
// 
// 	public void setPrice(BigDecimal price) {
// 		this.price = price;
// 	}
// 
// 	public int getQuantity() {
// 		return quantity;
// 	}
// 
// 	public void setQuantity(int quantity) {
// 		this.quantity = quantity;
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// }
// 
// Path: anemic-vs-rich-domain-model/src/main/java/com/link_intersystems/blog/model/anemic/OrderService.java
// public class OrderService {
// 
// 	public void calculateTotal(Order order) {
// 		if (order == null) {
// 			throw new IllegalArgumentException("order must not be null");
// 		}
// 
// 		BigDecimal total = BigDecimal.ZERO;
// 		List<OrderItem> items = order.getItems();
// 
// 		for (OrderItem orderItem : items) {
// 			int quantity = orderItem.getQuantity();
// 			BigDecimal price = orderItem.getPrice();
// 			BigDecimal itemTotal = price.multiply(new BigDecimal(quantity));
// 			total = total.add(itemTotal);
// 		}
// 		order.setTotal(total);
// 	}
// }


// Path: anemic-vs-rich-domain-model/src/test/java/com/link_intersystems/blog/model/anemic/OrderTest.java
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import java.math.BigDecimal;
import org.junit.Test;
import com.link_intersystems.blog.model.anemic.Order;
import com.link_intersystems.blog.model.anemic.OrderItem;
import com.link_intersystems.blog.model.anemic.OrderService;

package com.link_intersystems.blog.model.anemic;





public class OrderTest {

	/**
	 * This test shows that an anemic model can be in an inconsistent state,
	 * because it doesn't handle it's state changes. So an anemic model can
	 * never guarantee that it is in a legal state. State handling of an anemic
	 * model is placed outside that object in classes mostly named "Service",
	 * "Helper", "Util", "Manager" etc.
	 * <p>
	 * <blockquote> The problem with an anemic model is that a client must know
	 * in which state the object it uses is and which service methods it has to
	 * call if it changes the state of an anemic model to keep the object in a
	 * legal state. </blockquote>
	 * </p>
	 */
	@Test
	public void anAnemicModelCanBeInconsistent() {
		OrderService orderService = new OrderService();