Hello I have a JSE (desktop) application which uses JPA.
When I try to JUnitTest it, I run into a strange problem.
Basically I have two Entities which extend a superclass.
I need to test that the attribute nr is unique for each subclass, but that same values are allowed between subclasses.
I think this works, but my JUnit test behaves strangely:
When run each test in isolation, the tests pass. But when I run the whole class, testUniqueNr() is executed and then the RollbackException somehow causes
public void cleanUp()
not to be executed and the testSelbeNrInVerschiedenenSchluessellisten() fails.
When I (expected=RollbackException.class) and use a try catch block I get the same behavior.
Many thanks for any input
from my pom.xml:
posted 1 year ago
I have to correct myself slightly. The debugging with the failed test indication had confused me.
After the execution of
is executed, but there a ConstraintViolation exception is thrown while I try to delete the entities.:
javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: ORA-00001: unique constraint (TEST.SYS_C0013343) violated
So the problem occurs when I run cleanUp after testUniqueNr where the exeption is excpected.