1
0
mirror of synced 2026-05-22 21:33:16 +00:00

Convert to assertj

Fixes gh-3175
This commit is contained in:
Billy Korando
2015-12-19 09:29:21 -06:00
committed by Rob Winch
parent bb600a473e
commit 71d4ce96ad
153 changed files with 2472 additions and 2202 deletions
@@ -44,8 +44,7 @@ public class AbstractCsrfTagTests {
int returned = this.tag.doEndTag();
assertThat(returned).as("The returned value is not correct.").isEqualTo(TagSupport.EVAL_PAGE);
assertEquals("The output value is not correct.", "",
this.response.getContentAsString());
assertThat(this.response.getContentAsString()).withFailMessage("The output value is not correct.").isEqualTo("");
}
@Test
@@ -61,8 +60,7 @@ public class AbstractCsrfTagTests {
int returned = this.tag.doEndTag();
assertThat(returned).as("The returned value is not correct.").isEqualTo(TagSupport.EVAL_PAGE);
assertEquals("The output value is not correct.", "fooBarBazQux",
this.response.getContentAsString());
assertThat(this.response.getContentAsString()).withFailMessage("The output value is not correct.").isEqualTo("fooBarBazQux");
assertThat(this.tag.token).as("The token is not correct.").isSameAs(token);
}
@@ -79,8 +77,7 @@ public class AbstractCsrfTagTests {
int returned = this.tag.doEndTag();
assertThat(returned).as("The returned value is not correct.").isEqualTo(TagSupport.EVAL_PAGE);
assertEquals("The output value is not correct.", "<input type=\"hidden\" />",
this.response.getContentAsString());
assertThat(this.response.getContentAsString()).withFailMessage("The output value is not correct.").isEqualTo("<input type=\"hidden\" />");
assertThat(this.tag.token).as("The token is not correct.").isSameAs(token);
}
@@ -27,9 +27,8 @@ public class CsrfInputTagTests {
String value = this.tag.handleToken(token);
assertThat(value).as("The returned value should not be null.").isNotNull();
assertEquals("The output is not correct.",
"<input type=\"hidden\" name=\"_csrf\" value=\"abc123def456ghi789\" />",
value);
assertThat(
value).withFailMessage("The output is not correct.").isEqualTo("<input type=\"hidden\" name=\"_csrf\" value=\"abc123def456ghi789\" />");
}
@Test
@@ -40,9 +39,6 @@ public class CsrfInputTagTests {
String value = this.tag.handleToken(token);
assertThat(value).as("The returned value should not be null.").isNotNull();
assertEquals(
"The output is not correct.",
"<input type=\"hidden\" name=\"csrfParameter\" value=\"fooBarBazQux\" />",
value);
assertThat(value).withFailMessage("The output is not correct.").isEqualTo("<input type=\"hidden\" name=\"csrfParameter\" value=\"fooBarBazQux\" />");
}
}
@@ -27,10 +27,9 @@ public class CsrfMetaTagsTagTests {
String value = this.tag.handleToken(token);
assertThat(value).as("The returned value should not be null.").isNotNull();
assertEquals("The output is not correct.",
"<meta name=\"_csrf_parameter\" content=\"_csrf\" />"
+ "<meta name=\"_csrf_header\" content=\"X-Csrf-Token\" />"
+ "<meta name=\"_csrf\" content=\"abc123def456ghi789\" />", value);
assertThat(value).withFailMessage("The output is not correct.").isEqualTo("<meta name=\"_csrf_parameter\" content=\"_csrf\" />"
+ "<meta name=\"_csrf_header\" content=\"X-Csrf-Token\" />"
+ "<meta name=\"_csrf\" content=\"abc123def456ghi789\" />");
}
@Test
@@ -41,9 +40,8 @@ public class CsrfMetaTagsTagTests {
String value = this.tag.handleToken(token);
assertThat(value).as("The returned value should not be null.").isNotNull();
assertEquals("The output is not correct.",
"<meta name=\"_csrf_parameter\" content=\"csrfParameter\" />"
+ "<meta name=\"_csrf_header\" content=\"csrfHeader\" />"
+ "<meta name=\"_csrf\" content=\"fooBarBazQux\" />", value);
assertThat(value).withFailMessage("The output is not correct.").isEqualTo("<meta name=\"_csrf_parameter\" content=\"csrfParameter\" />"
+ "<meta name=\"_csrf_header\" content=\"csrfHeader\" />"
+ "<meta name=\"_csrf\" content=\"fooBarBazQux\" />");
}
}