In my arquillian test a number of application methods are called, which either read data from the database or create data and persist to database. a) At some point a method annotated with @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
is called. The test fails as the annotated method cannot find(on read it returns 0 records) some data persisted by some previous called methods(annotated with TransactionAttributeType.REQUIRED). Probably this is a normal behavior as a new Transaction opens. Reading the data in a previous called method and passing them as parameters to the annotated(TransactionAttributeType.REQUIRE) method works fine, but data should be read inside the REQUIRES_NEW method. Same problem appears in other tests when the TransactionAttributeType.REQUIRES_NEW is used. Is there a workaround to handle this case?
b) I've also mentioned that arquillian has issues with methods annotated with @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
. It is like the code in these methods is not executed at all.
My current solution for both issues is to create a Mock class overriding the problematic methods. In case of b, the overridden method is annotated with @TransactionAttribute(TransactionAttributeType.SUPPORTS)
.