I\'m testing a controller that returns a json response but the tests fail after the first time because the h2 database does not reset the auto increment id. Using fixtures o
If you are using Spring, I found this blog post which suggests using @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
So that each test uses a new application context, thereby resetting the db increments.