Skip to content

Commit

Permalink
Added "test retrieving all items in an order"
Browse files Browse the repository at this point in the history
  • Loading branch information
monger committed Mar 12, 2013
1 parent 3dfb618 commit b330832
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Expand Up @@ -21,7 +21,6 @@ public class Order implements Serializable {
private Date date;

@OneToMany(mappedBy = "orderId", fetch = FetchType.EAGER, cascade = CascadeType.ALL)

private Set<Item> orderItems;

public long getId() {
Expand Down
Expand Up @@ -68,6 +68,21 @@ class OrderIT extends IntegrationBootstrap {
assert loadedOrderItem == newOrderList[0].orderItems.toArray()[0]
}

@Test(groups = ["long-integration"])
void "test retrieving all items in an order"() {
def loadedOrder = orderDao.loadOrder(newOrderList[0].id)
List<Item> loadedOrderItems = orderDao.getOrderItemsForOrder(loadedOrder.id)
loadedOrder.orderItems.collect { actualItem ->
def match = false
loadedOrderItems.collect { testItem ->
if (testItem == actualItem) {
match = true
}
}
assert match
}
}

@Test(groups = ["long-integration"])
void "test deletion of an order item"() {
def orderItemId = ((Item) newOrderList[1].orderItems.toArray()[0]).id
Expand Down

0 comments on commit b330832

Please sign in to comment.