浏览代码

Fix ApacheDSEmbeddedLdifTests checkstyle

Issue gh-54
Rob Winch 9 年之前
父节点
当前提交
77a478ba0d

+ 38 - 33
ldap/src/integration-test/java/org/springframework/security/ldap/server/ApacheDSEmbeddedLdifTests.java

@@ -19,54 +19,59 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
+
 import org.springframework.ldap.core.support.LdapContextSource;
 import org.springframework.security.ldap.SpringSecurityLdapTemplate;
 
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
- * Tests reproducing problems with loading structures from ldif on embedded ApacheDS server.
+ * Tests reproducing problems with loading structures from ldif on embedded ApacheDS
+ * server.
  *
  * @author Marcin Zajączkowski
  */
 public class ApacheDSEmbeddedLdifTests {
 
-    private static final String LDAP_ROOT = "ou=ssattributes,dc=springframework,dc=org";
-    private static final int LDAP_PORT = 52389;
+	private static final String LDAP_ROOT = "ou=ssattributes,dc=springframework,dc=org";
+	private static final int LDAP_PORT = 52389;
 
-    private ApacheDSContainer server;
-    private SpringSecurityLdapTemplate ldapTemplate;
+	private ApacheDSContainer server;
+	private SpringSecurityLdapTemplate ldapTemplate;
 
-    @Before
-    public void setUp() throws Exception {
-        //TODO: InMemoryXmlApplicationContext would be useful here, but it is not visible
-        server = new ApacheDSContainer(LDAP_ROOT, "classpath:test-server-custom-attribute-types.ldif");
-        server.setPort(LDAP_PORT);
-        server.afterPropertiesSet();
+	@Before
+	public void setUp() throws Exception {
+		// TODO: InMemoryXmlApplicationContext would be useful here, but it is not visible
+		this.server = new ApacheDSContainer(LDAP_ROOT,
+				"classpath:test-server-custom-attribute-types.ldif");
+		this.server.setPort(LDAP_PORT);
+		this.server.afterPropertiesSet();
 
-        ldapTemplate = new SpringSecurityLdapTemplate(createLdapContextSource());
-    }
+		this.ldapTemplate = new SpringSecurityLdapTemplate(createLdapContextSource());
+	}
 
-    private LdapContextSource createLdapContextSource() throws Exception {
-        LdapContextSource ldapContextSource = new LdapContextSource();
-        ldapContextSource.setUrl("ldap://localhost:" + LDAP_PORT);
-        ldapContextSource.setBase(LDAP_ROOT);
-        ldapContextSource.afterPropertiesSet();
-        return ldapContextSource;
-    }
+	private LdapContextSource createLdapContextSource() throws Exception {
+		LdapContextSource ldapContextSource = new LdapContextSource();
+		ldapContextSource.setUrl("ldap://localhost:" + LDAP_PORT);
+		ldapContextSource.setBase(LDAP_ROOT);
+		ldapContextSource.afterPropertiesSet();
+		return ldapContextSource;
+	}
 
-    @After
-    public void tearDown() throws Exception {
-        if (server != null) {
-            server.destroy();
-        }
-    }
+	@After
+	public void tearDown() throws Exception {
+		if (this.server != null) {
+			this.server.destroy();
+		}
+	}
 
-    @Ignore //Not fixed yet
-    @Test   //SEC-2387
-    public void customAttributeTypesShouldBeProperlyCreatedWhenLoadedFromLdif() {
-        assertTrue(ldapTemplate.compare("uid=objectWithCustomAttribute1", "uid", "objectWithCustomAttribute1"));
-        assertTrue(ldapTemplate.compare("uid=objectWithCustomAttribute1", "customAttribute", "I am custom"));
-    }
+	@Ignore // Not fixed yet
+	@Test // SEC-2387
+	public void customAttributeTypesShouldBeProperlyCreatedWhenLoadedFromLdif() {
+		assertThat(this.ldapTemplate.compare("uid=objectWithCustomAttribute1", "uid",
+				"objectWithCustomAttribute1")).isTrue();
+		assertThat(this.ldapTemplate.compare("uid=objectWithCustomAttribute1",
+				"customAttribute", "I am custom")).isTrue();
+	}
 
 }