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.
This commit is contained in:
Andy Wilkinson
2015-04-28 14:24:01 -05:00
committed by Rob Winch
parent 3f0a443be8
commit b271b1fd66
2 changed files with 6 additions and 0 deletions

View File

@@ -32,6 +32,8 @@ import org.springframework.ldap.query.SearchScope;
import org.springframework.ldap.support.LdapUtils;
import org.springframework.ldap.test.AttributeCheckAttributesMapper;
import org.springframework.ldap.test.AttributeCheckContextMapper;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
import javax.naming.Name;
@@ -53,6 +55,7 @@ import static org.springframework.ldap.query.LdapQueryBuilder.query;
* @author Mattias Hellborg Arthursson
*/
@ContextConfiguration(locations = {"/conf/ldapTemplateTestContext.xml"})
@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
public class LdapTemplateSearchResultITest extends AbstractLdapTemplateIntegrationTest {
@Autowired

View File

@@ -30,6 +30,8 @@ import org.springframework.ldap.query.SearchScope;
import org.springframework.ldap.support.LdapUtils;
import org.springframework.ldap.test.AttributeCheckAttributesMapper;
import org.springframework.ldap.test.AttributeCheckContextMapper;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
import javax.naming.Name;
@@ -50,6 +52,7 @@ import static org.springframework.ldap.query.LdapQueryBuilder.query;
* @author Mattias Hellborg Arthursson
*/
@ContextConfiguration(locations = {"/conf/ldapTemplateNamespaceTestContext.xml"})
@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
public class LdapTemplateSearchResultNamespaceConfigITest extends AbstractLdapTemplateIntegrationTest {
@Autowired