I'm writing a lot of integration tests for Quadran. I just wrote one where I needed to traverse a a complicated series of relationships, including collective relationships, through my domain model to test that a collection was initialized by Hibernate JPA. Here's the code:
void testFindForViewPoAssociationsAreFetched () {
def dao = SpringContextTestFactory.getJpaContext().getBean ("orderDao");
def order = dao.findForViewPo ("4371665");
assertTrue ("TransportOrders were not fetched",
order.orderLineItems.orderShipments.shipmentLineItem.shipment.transportOrders.size > 0);
}
Notice the Groovy Path statement in the assertTrue method call. That would be a lot longer in Java to do the same thing. At least two iterators, and a whole lot of getThis, getThat ugliness.
I wrote that one and just said a big mental, "WOW!"
Recent comments
6 weeks 4 days ago
7 weeks 2 days ago
7 weeks 5 days ago
8 weeks 5 days ago
9 weeks 1 day ago
9 weeks 1 day ago
9 weeks 5 days ago
12 weeks 6 days ago
13 weeks 4 days ago
13 weeks 4 days ago