incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r691152 - in /incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest: NodetypeRenderingTest.java RenderingTestBase.java
Date Tue, 02 Sep 2008 08:37:31 GMT
Author: bdelacretaz
Date: Tue Sep  2 01:37:31 2008
New Revision: 691152

URL: http://svn.apache.org/viewvc?rev=691152&view=rev
Log:
simplify tests using assertContains

Modified:
    incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/NodetypeRenderingTest.java
    incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/RenderingTestBase.java

Modified: incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/NodetypeRenderingTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/NodetypeRenderingTest.java?rev=691152&r1=691151&r2=691152&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/NodetypeRenderingTest.java
(original)
+++ incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/NodetypeRenderingTest.java
Tue Sep  2 01:37:31 2008
@@ -51,12 +51,12 @@
 
     public void testWithoutScriptTxt() throws IOException {
         final String content = getContent(displayUrl + ".txt", CONTENT_TYPE_PLAIN);
-        assertTrue("Content includes PlainTextRendererServlet marker",content.contains("dumped
by PlainTextRendererServlet"));
+        assertContains(content, "dumped by PlainTextRendererServlet");
     }
 
     public void testWithoutScriptHtml() throws IOException {
         final String content = getContent(displayUrl + ".html", CONTENT_TYPE_HTML);
-        assertTrue("Content contains default rendering",content.contains("Resource dumped
by HtmlRendererServlet"));
+        assertContains(content, "dumped by HtmlRendererServlet");
     }
 
     public void testMiniScriptHtml() throws IOException {
@@ -74,8 +74,7 @@
         try {
             final String content = getContent(displayUrl + ".html", CONTENT_TYPE_HTML);
             final String expected = "print.esp ends";
-            assertTrue("Content (" + content + ") must contain '" + expected + "'",
-                    content.contains(expected));
+            assertContains(content, expected);
         } finally {
             testClient.delete(toDelete);
         }
@@ -85,8 +84,8 @@
         final String toDelete = uploadTestScript("rendering-test.esp","html.esp");
         try {
             final String content = getContent(displayUrl + ".html", CONTENT_TYPE_HTML);
-            assertTrue("Content includes ESP marker",content.contains("ESP template"));
-            assertTrue("Content contains formatted test text",content.contains("<p>"
+ testText + "</p>"));
+            assertContains(content, "ESP template");
+            assertContains(content, "<p>" + testText + "</p>");
         } finally {
             testClient.delete(toDelete);
         }
@@ -96,8 +95,8 @@
         final String toDelete = uploadTestScript("rendering-test.esp","xml.esp");
         try {
             final String content = getContent(displayUrl + ".xml", CONTENT_TYPE_XML);
-            assertTrue("Content includes ESP marker",content.contains("ESP template"));
-            assertTrue("Content contains formatted test text",content.contains("<p>"
+ testText + "</p>"));
+            assertContains(content, "ESP template");
+            assertContains(content, "<p>" + testText + "</p>");
         } finally {
             testClient.delete(toDelete);
         }
@@ -117,8 +116,8 @@
         final String toDelete = uploadTestScript(path,"rendering-test.esp","html.esp");
         try {
             final String content = getContent(displayUrl + ".html", CONTENT_TYPE_HTML);
-            assertTrue("Content includes ESP marker",content.contains("ESP template"));
-            assertTrue("Content contains formatted test text",content.contains("<p>"
+ testText + "</p>"));
+            assertContains(content, "ESP template");
+            assertContains(content, "<p>" + testText + "</p>");
         } finally {
             testClient.delete(toDelete);
         }
@@ -128,8 +127,8 @@
         final String toDelete = uploadTestScript("rendering-test.esp","txt.esp");
         try {
             final String content = getContent(displayUrl + ".txt", CONTENT_TYPE_PLAIN);
-            assertTrue("Content includes ESP marker",content.contains("ESP template"));
-            assertTrue("Content contains formatted test text",content.contains("<p>"
+ testText + "</p>"));
+            assertContains(content, "ESP template");
+            assertContains(content, "<p>" + testText + "</p>");
         } finally {
             testClient.delete(toDelete);
         }

Modified: incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/RenderingTestBase.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/RenderingTestBase.java?rev=691152&r1=691151&r2=691152&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/RenderingTestBase.java
(original)
+++ incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/RenderingTestBase.java
Tue Sep  2 01:37:31 2008
@@ -30,4 +30,10 @@
     protected String uploadTestScript(String localFilename,String filenameOnServer) throws
IOException {
         return uploadTestScript(scriptPath, localFilename, filenameOnServer);
     }
+    
+    protected void assertContains(String content, String expected) {
+        if(!content.contains(expected)) {
+            fail("Content does not contain '" + expected + "' (content=" + content + ")");
+        }
+    }
 }
\ No newline at end of file



Mime
View raw message