Author: thrantal Date: Tue Dec 2 17:24:47 2008 New Revision: 722710 URL: http://svn.apache.org/viewvc?rev=722710&view=rev Log: WICKET-1781: Making the test more robust. A better fix would a better testing framework where you can handle XML better (or at least an XML testing library for JUnit).
Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/ParentResourceEscapePathTest.java Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/ParentResourceEscapePathTest.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/ParentResourceEscapePathTest.java?rev=722710&r1=722709&r2=722710&view=diff ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/ParentResourceEscapePathTest.java (original) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/ParentResourceEscapePathTest.java Tue Dec 2 17:24:47 2008 @@ -37,12 +37,16 @@ tester.assertRenderedPage(ParentResourceEscapePathTestPage.class); tester.assertNoErrorMessage(); - final StringBuilder expectedHtml = new StringBuilder(); - expectedHtml.append("<html><head><wicket:link><script type=\"text/javascript\" src=\""); - expectedHtml.append(expectedResourceUrl()); - expectedHtml.append("\"></script></wicket:link></head></html>"); + String html = tester.getServletResponse().getDocument(); + assertContains(html, "<html><head><wicket:link><script "); + assertContains(html, " type=\"text/javascript\""); + assertContains(html, "src=\"" + expectedResourceUrl() + "\""); + assertContains(html, "\"></script></wicket:link></head></html>"); + } - assertEquals(expectedHtml.toString(), tester.getServletResponse().getDocument()); + private void assertContains(String html, String expected) + { + assertTrue(html, html.contains(expected)); } public void testResourceUrlGeneratedByResourceReference()