Convert to assertj
Fixes gh-3175
This commit is contained in:
+3
-6
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+3
-7
@@ -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\" />");
|
||||
}
|
||||
}
|
||||
|
||||
+6
-8
@@ -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\" />");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user