maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r734154 - /maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
Date Tue, 13 Jan 2009 15:30:58 GMT
Author: ltheussl
Date: Tue Jan 13 07:30:52 2009
New Revision: 734154

URL: http://svn.apache.org/viewvc?rev=734154&view=rev
Log:
Make test assert something...

Modified:
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java?rev=734154&r1=734153&r2=734154&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
Tue Jan 13 07:30:52 2009
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import java.io.StringWriter;
 import org.apache.maven.doxia.sink.AbstractSinkTest;
 import org.apache.maven.doxia.sink.Sink;
 
@@ -50,20 +51,44 @@
         return true;
     }
 
+    /**
+     * Test link generation.
+     *
+     * @throws java.lang.Exception if any.
+     */
     public void testLinks()
         throws Exception
     {
-        Writer writer = getXmlTestWriter( "links" );
-        XhtmlSink sink = (XhtmlSink) createSink( writer );
-        sink.link( "http:/www.xdoc.com" );
-        sink.link_();
-        sink.link( "./index.html#anchor" );
-        sink.link_();
-        sink.link( "../index.html#anchor" );
-        sink.link_();
-        sink.link( "index.html" );
-        sink.link_();
-        sink.close();
+        XhtmlSink sink = null;
+
+        try
+        {
+            Writer writer =  new StringWriter();
+            sink = (XhtmlSink) createSink( writer );
+            sink.link( "http:/www.xdoc.com" );
+            sink.link_();
+            sink.link( "./index.html#anchor" );
+            sink.link_();
+            sink.link( "../index.html#anchor" );
+            sink.link_();
+            sink.link( "index.html" );
+            sink.link_();
+
+            String actual = writer.toString();
+            assertTrue( actual.indexOf( "<a class=\"externalLink\" href=\"http:/www.xdoc.com\"></a>"
) != -1 );
+            assertTrue( actual.indexOf( "<a href=\"./index.html#anchor\"></a>"
) != -1 );
+            assertTrue( actual.indexOf( "<a href=\"../index.html#anchor\"></a>"
) != -1 );
+            assertTrue( actual.indexOf( "<a href=\"index.html\"></a>" ) != -1
);
+
+            sink.close();
+        }
+        finally
+        {
+            if ( sink != null )
+            {
+                sink.close();
+            }
+        }
     }
 
     /** {@inheritDoc} */



Mime
View raw message