I am having trouble getting consecutive tests with clean contexts to work and I am not sure what I am doing wrong here. I suspect that the context is not cleaned properly.

When running multiple tests consecutively, the context of the previous test does not seem to be cleaned up properly when using @DirtiesContext(classMode = ClassMode.BEFORE_CLASS). In my particular case, I am running some tests with a @EnableJpaAuditing configured and some without. Running tests individually, they all pass, but running them together in a certain order, they influence eachother. I would expect the context to be clean for the entire test class when using @DirtiesContext(classMode = ClassMode.BEFORE_CLASS).

I created a reproducer here: https://github.com/maxhov/dirties-context/blob/master/src/test/java/com/example/dirtiescontext/DirtiesContextTest.java