Different Singleton instances with JUnit tests
Spring provides a test annotation called @DirtiesContext which is very helpful when testing singleton beans. When added at the class level with the class mode set to AFTER_EACH_TEST_METHOD, spring creates a new application context for every test case (method). This annotation comes to your rescue when you have some state in your singleton class.
Posted on March 20, 2011, in junit, spring and tagged junit, spring. Bookmark the permalink. Leave a comment.
Leave a comment
Comments 0