Skip to content

Commit

Permalink
Updated assertion methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
yyfMichaelYan committed Nov 16, 2021
1 parent e703e50 commit a2446b9
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
import java.io.StringWriter;

import static org.apache.struts2.views.jsp.AbstractUITagTest.normalize;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.endsWith;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;

public class FreemarkerResultMockedTest extends StrutsInternalTestCase {

Expand Down Expand Up @@ -114,10 +119,11 @@ public void testDynamicAttributesSupport() throws Exception {
dispatcher.serviceAction(request, response, mapping);

String result = stringWriter.toString();
assertTrue((result.contains("<input type=\"text\" name=\"test\" value=\"\" id=\"test\" foo=\"bar\" placeholder=\"input\"/>")
|| result.contains("<input type=\"text\" name=\"test\" value=\"\" id=\"test\" placeholder=\"input\" foo=\"bar\"/>"))
&& result.endsWith("<input type=\"text\" name=\"test\" value=\"\" id=\"test\" break=\"true\"/>"
+ "<input type=\"text\" name=\"required\" value=\"\" id=\"required\" required=\"true\"/>"));
assertThat(result, allOf(startsWith("<input type=\"text\" name=\"test\" value=\"\" id=\"test\""),
containsString("foo=\"bar\""),
containsString("placeholder=\"input\""),
endsWith("<input type=\"text\" name=\"test\" value=\"\" id=\"test\" break=\"true\"/>"
+ "<input type=\"text\" name=\"required\" value=\"\" id=\"required\" required=\"true\"/>")));
}

public void testManualListInTemplate() throws Exception {
Expand Down

0 comments on commit a2446b9

Please sign in to comment.