Start AssertJ Migration

Issue gh-3175
This commit is contained in:
Rob Winch
2015-12-16 10:38:31 -06:00
parent 6cbb439701
commit bb600a473e
355 changed files with 3036 additions and 3133 deletions

View File

@@ -2,7 +2,8 @@ package org.springframework.security.integration;
import net.sourceforge.jwebunit.junit.WebTester;
import org.junit.Assert;
import static org.assertj.core.api.Assertions.*;
import org.springframework.security.core.session.SessionRegistry;
import org.testng.annotations.Test;
@@ -29,8 +30,8 @@ public class CustomConcurrentSessionManagementTests extends
tester2.setTextField("password", "jimispassword");
tester2.setIgnoreFailingStatusCodes(true);
tester2.submit();
Assert.assertTrue(tester2.getServerResponse().contains(
"Maximum sessions of 1 for this principal exceeded"));
assertThat(tester2.getServerResponse()).contains(
"Maximum sessions of 1 for this principal exceeded");
}
@Test
@@ -50,6 +51,6 @@ public class CustomConcurrentSessionManagementTests extends
tester2.setTextField("password", "bessiespassword");
tester2.setIgnoreFailingStatusCodes(true);
tester2.submit();
Assert.assertTrue(tester2.getServerResponse().contains("A secure page"));
assertThat(tester2.getServerResponse()).contains("A secure page");
}
}

View File

@@ -1,11 +1,10 @@
package org.springframework.security.integration;
import static org.testng.Assert.*;
import static org.assertj.core.api.Assertions.*;
import javax.servlet.http.Cookie;
import net.sourceforge.jwebunit.junit.WebTester;
import org.testng.annotations.Test;
/**
@@ -65,7 +64,7 @@ public class InMemoryProviderWebAppTests extends AbstractWebServerIntegrationTes
tester.checkCheckbox("remember-me");
login("jimi", "jimispassword");
Cookie rememberMe = getRememberMeCookie();
assertNotNull(rememberMe);
assertThat(rememberMe).isNotNull();
tester.closeBrowser();
tester.getTestContext().addCookie(rememberMe);

View File

@@ -1,6 +1,7 @@
package org.springframework.security.integration;
import static org.testng.Assert.*;
import static org.assertj.core.api.Assertions.*;
import org.testng.annotations.Test;
@@ -20,14 +21,14 @@ public final class JspTaglibTests extends AbstractWebServerIntegrationTests {
beginAt("secure/authenticationTagTestPage.jsp");
login("theescapist<>&.", "theescapistspassword");
String response = tester.getServerResponse();
assertTrue(response
.contains("This is the unescaped authentication name: theescapist<>&."));
assertTrue(response
.contains("This is the unescaped principal.username: theescapist<>&."));
assertTrue(response
.contains("This is the authentication name: theescapist&lt;&gt;&amp;&#46;"));
assertTrue(response
.contains("This is the principal.username: theescapist&lt;&gt;&amp;&#46;"));
assertThat(response)
.contains("This is the unescaped authentication name: theescapist<>&.");
assertThat(response)
.contains("This is the unescaped principal.username: theescapist<>&.");
assertThat(response)
.contains("This is the authentication name: theescapist&lt;&gt;&amp;&#46;");
assertThat(response)
.contains("This is the principal.username: theescapist&lt;&gt;&amp;&#46;");
}
@Test
@@ -35,10 +36,10 @@ public final class JspTaglibTests extends AbstractWebServerIntegrationTests {
beginAt("secure/authorizationTagTestPage.jsp");
login("bessie", "bessiespassword");
String response = tester.getServerResponse();
assertTrue(response
.contains("Users can see this and 'allowed' variable is true."));
assertFalse(response.contains("Role X users (nobody) can see this."));
assertTrue(response.contains("Role X expression evaluates to false"));
assertThat(response)
.contains("Users can see this and 'allowed' variable is true.");
assertThat(response).doesNotContain("Role X users (nobody) can see this.");
assertThat(response).contains("Role X expression evaluates to false");
}
}