Skip to content

Commit b271b1f

Browse files
wilkinsonaRob Winch
authored andcommitted
LDAP-328: DirtiesContext for Integration Tests that have Order issues
The upgrade to JUnit 4.11 has revealed some integration tests whose success was dependant on them being run in a particular order. To overcome this the classes containing these tests have been marked with @DirtiesContext configured to renew the application context after each test method.
1 parent 3f0a443 commit b271b1f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateSearchResultITest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import org.springframework.ldap.support.LdapUtils;
3333
import org.springframework.ldap.test.AttributeCheckAttributesMapper;
3434
import org.springframework.ldap.test.AttributeCheckContextMapper;
35+
import org.springframework.test.annotation.DirtiesContext;
36+
import org.springframework.test.annotation.DirtiesContext.ClassMode;
3537
import org.springframework.test.context.ContextConfiguration;
3638

3739
import javax.naming.Name;
@@ -53,6 +55,7 @@
5355
* @author Mattias Hellborg Arthursson
5456
*/
5557
@ContextConfiguration(locations = {"/conf/ldapTemplateTestContext.xml"})
58+
@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
5659
public class LdapTemplateSearchResultITest extends AbstractLdapTemplateIntegrationTest {
5760

5861
@Autowired

test/integration-tests/src/test/java/org/springframework/ldap/itest/LdapTemplateSearchResultNamespaceConfigITest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import org.springframework.ldap.support.LdapUtils;
3131
import org.springframework.ldap.test.AttributeCheckAttributesMapper;
3232
import org.springframework.ldap.test.AttributeCheckContextMapper;
33+
import org.springframework.test.annotation.DirtiesContext;
34+
import org.springframework.test.annotation.DirtiesContext.ClassMode;
3335
import org.springframework.test.context.ContextConfiguration;
3436

3537
import javax.naming.Name;
@@ -50,6 +52,7 @@
5052
* @author Mattias Hellborg Arthursson
5153
*/
5254
@ContextConfiguration(locations = {"/conf/ldapTemplateNamespaceTestContext.xml"})
55+
@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
5356
public class LdapTemplateSearchResultNamespaceConfigITest extends AbstractLdapTemplateIntegrationTest {
5457

5558
@Autowired

0 commit comments

Comments
 (0)