Skip to content

Commit

Permalink
Merge pull request #506 from yyfMichaelYan/testDynamicAttributesSupport
Browse files Browse the repository at this point in the history
Fix flaky test testDynamicAttributesSupport.
  • Loading branch information
lukaszlenart committed Nov 16, 2021
2 parents f46104f + a2446b9 commit 0c9d769
Showing 1 changed file with 10 additions and 8 deletions.
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 @@ -113,15 +118,12 @@ public void testDynamicAttributesSupport() throws Exception {
ActionMapping mapping = container.getInstance(ActionMapper.class).getMapping(request, configurationManager);
dispatcher.serviceAction(request, response, mapping);

String expected =
"<input type=\"text\" name=\"test\" value=\"\" id=\"test\" foo=\"bar\" placeholder=\"input\"/>"
+ "<input type=\"text\" name=\"test\" value=\"\" id=\"test\" foo=\"bar\" placeholder=\"input\"/>"
+ "<input type=\"text\" name=\"test\" value=\"\" id=\"test\" break=\"true\"/>"
+ "<input type=\"text\" name=\"required\" value=\"\" id=\"required\" required=\"true\"/>";

String result = stringWriter.toString();

assertEquals(expected, result);
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 0c9d769

Please sign in to comment.