Hello,

I'm writing my tests and using the unit of work factory to create units 
of work so I can create entities to test against.  So it goes something like

@Test public void testSomething() {
    UnitOfWork uow = unitOfWorkFactory.newUnitOfWork();
    // do tests
    uow.complete();
}

This works great unless an exception is thrown during testing.  When 
that happens the uow.complete() is never called and the tearDown() 
method in AbstractQi4jTest throws an exception, which covers up the 
exception thrown during the test in the JUnit reporting.  So instead of 
throwing an exception, can we simply assume that if there is a 
currentUnitOfWork then we can just discard the unit?  So

        if( unitOfWorkFactory != null && 
unitOfWorkFactory.currentUnitOfWork() != null )
        {
            unitOfWorkFactory.currentUnitOfWork().discard();
        }

WDYT?

Thanks,
Rich

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to