maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r1058529 - in /maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src: main/java/org/apache/maven/doxia/site/decoration/inheritance/ test/java/org/apache/maven/doxia/site/decoration/inheritance/
Date Thu, 13 Jan 2011 12:14:50 GMT
Author: ltheussl
Date: Thu Jan 13 12:14:50 2011
New Revision: 1058529

URL: http://svn.apache.org/viewvc?rev=1058529&view=rev
Log:
add test for constructor

Modified:
    maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptor.java
    maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java

Modified: maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptor.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptor.java?rev=1058529&r1=1058528&r2=1058529&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptor.java
(original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/main/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptor.java
Thu Jan 13 12:14:50 2011
@@ -225,4 +225,16 @@ public class URIPathDescriptor
 
         return ( equalScheme && equalPort && equalHost );
     }
+
+    /**
+     * Construct a string representation of this URIPathDescriptor.
+     * This is equivalent to calling {@link #resolveLink()}.toString().
+     *
+     * @return this URIPathDescriptor as a String.
+     */
+    public String toString()
+    {
+        return resolveLink().toString();
+    }
+
 }

Modified: maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java?rev=1058529&r1=1058528&r2=1058529&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java
(original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java
Thu Jan 13 12:14:50 2011
@@ -21,6 +21,7 @@ package org.apache.maven.doxia.site.deco
  */
 
 import java.net.URI;
+import java.net.URISyntaxException;
 
 import junit.framework.TestCase;
 
@@ -33,6 +34,39 @@ public class URIPathDescriptorTest
         extends TestCase
 {
     /**
+     * Test of constructor, of class URIPathDescriptor.
+     *
+     * @throws Exception
+     */
+    public void testConstructor()
+            throws Exception
+    {
+        final String expected = "http://maven.apache.org/doxia";
+
+        final URIPathDescriptor path = new URIPathDescriptor( "http://maven.apache.org/",
"doxia" );
+        assertEquals( expected, path.toString() );
+
+        URIPathDescriptor compare = new URIPathDescriptor( "http://maven.apache.org", "/doxia"
);
+        assertEquals( expected, compare.toString() );
+
+        compare = new URIPathDescriptor( "http://maven.apache.org/./doxia/../", "/sub/./sub/../../doxia"
);
+        assertEquals( expected, compare.toString() );
+
+        compare = new URIPathDescriptor( "http://maven.apache.org/doxia", "" );
+        assertEquals( expected + "/", compare.toString() );
+
+        try
+        {
+            compare = new URIPathDescriptor( "/doxia", "http://maven.apache.org" );
+            fail();
+        }
+        catch ( URISyntaxException ex )
+        {
+            assertNotNull( ex );
+        }
+    }
+
+    /**
      * Test of resolveLink method, of class URIPathDescriptor.
      *
      * @throws Exception



Mime
View raw message