This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch DOXIASITETOOLS-217 in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git
commit 4d305533b42a83d4e5abe3582848f91291db6776 Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Mon Jan 6 13:12:03 2020 +0100 [DOXIASITETOOLS-217] Upgrade JUnit to 4.13 --- .../doxia/site/decoration/DecorationUtilsTest.java | 7 +- .../DecorationModelInheritanceAssemblerTest.java | 101 ++++++++++++++------- .../site/decoration/inheritance/Doxia91Test.java | 10 +- .../decoration/inheritance/PathDescriptorTest.java | 31 ++++++- .../site/decoration/inheritance/PathUtilsTest.java | 12 ++- .../inheritance/URIPathDescriptorTest.java | 29 ++++-- .../doxia/docrenderer/DocumentRendererTest.java | 2 - .../maven/doxia/tools/DefaultSiteToolTest.java | 12 ++- .../doxia/siterenderer/AttributesVerifier.java | 2 +- .../maven/doxia/siterenderer/EntitiesVerifier.java | 1 - .../doxia/siterenderer/SkinResourceLoaderTest.java | 7 +- pom.xml | 2 +- 12 files changed, 152 insertions(+), 64 deletions(-) diff --git a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/DecorationUtilsTest.java b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/DecorationUtilsTest.java index 35e2389..4d1e1c7 100644 --- a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/DecorationUtilsTest.java +++ b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/DecorationUtilsTest.java @@ -21,11 +21,13 @@ import org.codehaus.plexus.util.xml.Xpp3Dom; * under the License. */ -import junit.framework.TestCase; +import org.junit.Test; + +import static org.junit.Assert.*; public class DecorationUtilsTest - extends TestCase { + @Test public void testIsLink() { assertFalse( DecorationUtils.isLink( null ) ); @@ -39,6 +41,7 @@ public class DecorationUtilsTest assertTrue( DecorationUtils.isLink( "any-protocol://" ) ); } + @Test public void testGetCustomChild() { Xpp3Dom dom = new Xpp3Dom( "root" ); diff --git a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/DecorationModelInheritanceAssemblerTest.java b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/DecorationModelInheritanceAssemblerTest.java index 55edeaa..3869922 100644 --- a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/DecorationModelInheritanceAssemblerTest.java +++ b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/DecorationModelInheritanceAssemblerTest.java @@ -24,8 +24,6 @@ import java.io.Reader; import java.util.List; -import junit.framework.TestCase; - import org.apache.maven.doxia.site.decoration.Banner; import org.apache.maven.doxia.site.decoration.Body; import org.apache.maven.doxia.site.decoration.DecorationModel; @@ -36,6 +34,9 @@ import org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Reader; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.junit.Test; + +import static org.junit.Assert.*; /** * Test the inheritance assembler. @@ -43,7 +44,6 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException; * @author <a href="mailto:[email protected]">Brett Porter</a> */ public class DecorationModelInheritanceAssemblerTest - extends TestCase { private DecorationModelInheritanceAssembler assembler = new DefaultDecorationModelInheritanceAssembler(); @@ -54,6 +54,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testInheritance() throws IOException, XmlPullParserException { @@ -94,6 +95,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testSuppressedInheritance() throws IOException, XmlPullParserException { @@ -112,7 +114,7 @@ public class DecorationModelInheritanceAssemblerTest "http://maven.apache.org" ); // check that the 3 breadcrumb items from parent.xml are not inherited assertEquals( "child of child no inheritance: breadcrumbs count", 0, - childOfchildModel.getBody().getBreadcrumbs().size() ); + childOfchildModel.getBody().getBreadcrumbs().size() ); } /** @@ -120,6 +122,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testPathsResolvedWhenEmpty() throws IOException, XmlPullParserException { @@ -147,6 +150,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testPathsNotResolvedForExternalUrls() throws IOException, XmlPullParserException { @@ -168,14 +172,15 @@ public class DecorationModelInheritanceAssemblerTest private static void assertPathsNotResolvedForExternalUrls( final DecorationModel childModel ) { - assertEquals( "check left banner href", "http://jakarta.apache.org/", childModel.getBannerLeft().getHref() ); + assertEquals( "check left banner href", "http://jakarta.apache.org/", + childModel.getBannerLeft().getHref() ); assertEquals( "check left banner image", "http://jakarta.apache.org/images/jakarta-logo.gif", - childModel.getBannerLeft().getSrc() ); + childModel.getBannerLeft().getSrc() ); assertEquals( "check right banner href", "http://jakarta.apache.org/commons/sandbox", - childModel.getBannerRight().getHref() ); + childModel.getBannerRight().getHref() ); assertEquals( "check right banner image", "http://jakarta.apache.org/commons/images/logo.png", - childModel.getBannerRight().getSrc() ); + childModel.getBannerRight().getSrc() ); Logo poweredBy = childModel.getPoweredBy().get( 0 ); assertEquals( "check powered by logo href", "http://tomcat.apache.org/", poweredBy.getHref() ); @@ -197,6 +202,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testPathsResolvedForRelativeUrls() throws IOException, XmlPullParserException { @@ -219,10 +225,12 @@ public class DecorationModelInheritanceAssemblerTest private static void assertPathsResolvedForRelativeUrls( final DecorationModel childModel ) { assertEquals( "check left banner href", "../banner/left", childModel.getBannerLeft().getHref() ); - assertEquals( "check left banner image", "../images/jakarta-logo.gif", childModel.getBannerLeft().getSrc() ); + assertEquals( "check left banner image", "../images/jakarta-logo.gif", + childModel.getBannerLeft().getSrc() ); assertEquals( "check right banner href", "../banner/right/", childModel.getBannerRight().getHref() ); - assertEquals( "check right banner image", "../commons/images/logo.png", childModel.getBannerRight().getSrc() ); + assertEquals( "check right banner image", "../commons/images/logo.png", + childModel.getBannerRight().getSrc() ); Logo poweredBy = childModel.getPoweredBy().get( 0 ); assertEquals( "check powered by logo href", "../tomcat", poweredBy.getHref() ); @@ -244,6 +252,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testPathsResolvedForSubsiteUrls() throws IOException, XmlPullParserException { @@ -269,10 +278,12 @@ public class DecorationModelInheritanceAssemblerTest private static void assertPathsResolvedForSubsiteUrls( final DecorationModel childModel ) { assertEquals( "check left banner href", "../banner/left", childModel.getBannerLeft().getHref() ); - assertEquals( "check left banner image", "../images/jakarta-logo.gif", childModel.getBannerLeft().getSrc() ); + assertEquals( "check left banner image", "../images/jakarta-logo.gif", + childModel.getBannerLeft().getSrc() ); assertEquals( "check right banner href", "../banner/right/", childModel.getBannerRight().getHref() ); - assertEquals( "check right banner image", "../commons/images/logo.png", childModel.getBannerRight().getSrc() ); + assertEquals( "check right banner image", "../commons/images/logo.png", + childModel.getBannerRight().getSrc() ); Logo poweredBy = childModel.getPoweredBy().get( 0 ); assertEquals( "check powered by logo href", "../tomcat", poweredBy.getHref() ); @@ -294,6 +305,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testPathsResolvedForRelativeUrlsDepthOfTwo() throws IOException, XmlPullParserException { @@ -316,11 +328,12 @@ public class DecorationModelInheritanceAssemblerTest private static void assertPathsResolvedForRelativeUrlsDepthOfTwo( final DecorationModel childModel ) { assertEquals( "check left banner href", "../../banner/left", childModel.getBannerLeft().getHref() ); - assertEquals( "check left banner image", "../../images/jakarta-logo.gif", childModel.getBannerLeft().getSrc() ); + assertEquals( "check left banner image", "../../images/jakarta-logo.gif", + childModel.getBannerLeft().getSrc() ); assertEquals( "check right banner href", "../../banner/right/", childModel.getBannerRight().getHref() ); assertEquals( "check right banner image", "../../commons/images/logo.png", - childModel.getBannerRight().getSrc() ); + childModel.getBannerRight().getSrc() ); Logo poweredBy = childModel.getPoweredBy().get( 0 ); assertEquals( "check powered by logo href", "../../tomcat", poweredBy.getHref() ); @@ -342,6 +355,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testPathsResolvedForReverseRelativeUrls() throws IOException, XmlPullParserException { @@ -364,11 +378,12 @@ public class DecorationModelInheritanceAssemblerTest private static void assertPathsResolvedForReverseRelativeUrls( final DecorationModel childModel ) { assertEquals( "check left banner href", "doxia/banner/left", childModel.getBannerLeft().getHref() ); - assertEquals( "check left banner image", "doxia/images/jakarta-logo.gif", childModel.getBannerLeft().getSrc() ); + assertEquals( "check left banner image", "doxia/images/jakarta-logo.gif", + childModel.getBannerLeft().getSrc() ); assertEquals( "check right banner href", "doxia/banner/right/", childModel.getBannerRight().getHref() ); assertEquals( "check right banner image", "doxia/commons/images/logo.png", - childModel.getBannerRight().getSrc() ); + childModel.getBannerRight().getSrc() ); Logo poweredBy = childModel.getPoweredBy().get( 0 ); assertEquals( "check powered by logo href", "doxia/tomcat", poweredBy.getHref() ); @@ -390,6 +405,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testPathsResolvedForReverseRelativeUrlsDepthOfTwo() throws IOException, XmlPullParserException { @@ -413,11 +429,12 @@ public class DecorationModelInheritanceAssemblerTest { assertEquals( "check left banner href", "doxia/core/banner/left", childModel.getBannerLeft().getHref() ); assertEquals( "check left banner image", "doxia/core/images/jakarta-logo.gif", - childModel.getBannerLeft().getSrc() ); + childModel.getBannerLeft().getSrc() ); - assertEquals( "check right banner href", "doxia/core/banner/right/", childModel.getBannerRight().getHref() ); + assertEquals( "check right banner href", "doxia/core/banner/right/", + childModel.getBannerRight().getHref() ); assertEquals( "check right banner image", "doxia/core/commons/images/logo.png", - childModel.getBannerRight().getSrc() ); + childModel.getBannerRight().getSrc() ); Logo poweredBy = childModel.getPoweredBy().get( 0 ); assertEquals( "check powered by logo href", "doxia/core/tomcat", poweredBy.getHref() ); @@ -439,6 +456,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testPathsResolvedForUnrelatedRelativeUrls() throws IOException, XmlPullParserException { @@ -461,18 +479,19 @@ public class DecorationModelInheritanceAssemblerTest private static void assertPathsResolvedForUnrelatedRelativeUrls( final DecorationModel childModel ) { assertEquals( "check left banner href", "http://jakarta.apache.org/banner/left", - childModel.getBannerLeft().getHref() ); + childModel.getBannerLeft().getHref() ); assertEquals( "check left banner image", "http://jakarta.apache.org/images/jakarta-logo.gif", - childModel.getBannerLeft().getSrc() ); + childModel.getBannerLeft().getSrc() ); assertEquals( "check right banner href", "http://jakarta.apache.org/banner/right/", - childModel.getBannerRight().getHref() ); + childModel.getBannerRight().getHref() ); assertEquals( "check right banner image", "http://jakarta.apache.org/commons/images/logo.png", - childModel.getBannerRight().getSrc() ); + childModel.getBannerRight().getSrc() ); Logo poweredBy = childModel.getPoweredBy().get( 0 ); assertEquals( "check powered by logo href", "http://jakarta.apache.org/tomcat", poweredBy.getHref() ); - assertEquals( "check powered by logo image", "http://jakarta.apache.org/tomcat/logo.gif", poweredBy.getImg() ); + assertEquals( "check powered by logo image", "http://jakarta.apache.org/tomcat/logo.gif", + poweredBy.getImg() ); LinkItem breadcrumb = childModel.getBody().getBreadcrumbs().get( 0 ); assertEquals( "check breadcrumb href", "http://jakarta.apache.org/apache", breadcrumb.getHref() ); @@ -490,6 +509,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testNullParent() throws IOException, XmlPullParserException { @@ -513,6 +533,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testFullyPopulatedChild() throws IOException, XmlPullParserException { @@ -539,6 +560,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testFullyPopulatedParentAndEmptyChild() throws IOException, XmlPullParserException { @@ -571,6 +593,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testResolvingAllExternalUrls() throws IOException, XmlPullParserException { @@ -587,6 +610,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testResolvingAllRelativeUrls() throws IOException, XmlPullParserException { @@ -604,6 +628,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testResolvingAllSiteUrls() throws IOException, XmlPullParserException { @@ -656,6 +681,7 @@ public class DecorationModelInheritanceAssemblerTest * @throws IOException * @throws XmlPullParserException */ + @Test public void testResolvingEmptyDescriptor() throws IOException, XmlPullParserException { @@ -669,6 +695,7 @@ public class DecorationModelInheritanceAssemblerTest /** * */ + @Test public void testDuplicateParentElements() { DecorationModel model = new DecorationModel(); @@ -685,16 +712,18 @@ public class DecorationModelInheritanceAssemblerTest assertEquals( "Check size", 1, child.getBody().getLinks().size() ); assertEquals( "Check item", createLinkItem( "Foo", "http://foo.apache.org" ), - child.getBody().getLinks().get( 0 ) ); + child.getBody().getLinks().get( 0 ) ); assertEquals( "Check size", 1, child.getPoweredBy().size() ); - assertEquals( "Check item", createLogo( "Foo", "http://foo.apache.org", "http://foo.apache.org/foo.jpg" ), - child.getPoweredBy().get( 0 ) ); + assertEquals( "Check item", + createLogo( "Foo", "http://foo.apache.org", "http://foo.apache.org/foo.jpg" ), + child.getPoweredBy().get( 0 ) ); } /** * */ + @Test public void testDuplicateChildElements() { DecorationModel model = new DecorationModel(); @@ -711,11 +740,12 @@ public class DecorationModelInheritanceAssemblerTest assertEquals( "Check size", 1, model.getBody().getLinks().size() ); assertEquals( "Check item", createLinkItem( "Foo", "http://foo.apache.org" ), - model.getBody().getLinks().get( 0 ) ); + model.getBody().getLinks().get( 0 ) ); assertEquals( "Check size", 1, model.getPoweredBy().size() ); - assertEquals( "Check item", createLogo( "Foo", "http://foo.apache.org", "http://foo.apache.org/foo.jpg" ), - model.getPoweredBy().get( 0 ) ); + assertEquals( "Check item", + createLogo( "Foo", "http://foo.apache.org", "http://foo.apache.org/foo.jpg" ), + model.getPoweredBy().get( 0 ) ); assertEquals( "Modified parent!", new DecorationModel(), parent ); } @@ -723,6 +753,7 @@ public class DecorationModelInheritanceAssemblerTest /** * */ + @Test public void testBadHref() { final DecorationModel model = new DecorationModel(); @@ -731,12 +762,13 @@ public class DecorationModelInheritanceAssemblerTest assembler.resolvePaths( model, "http://foo.apache.org" ); assertEquals( "Check size", 1, model.getBody().getBreadcrumbs().size() ); assertEquals( "Check item", createLinkItem( "Foo", "http://foo.apache.org/${property}" ), - model.getBody().getBreadcrumbs().get( 0 ) ); + model.getBody().getBreadcrumbs().get( 0 ) ); } /** * */ + @Test public void testBreadcrumbWithoutHref() { DecorationModel model = new DecorationModel(); @@ -750,6 +782,7 @@ public class DecorationModelInheritanceAssemblerTest /** * */ + @Test public void testBreadcrumbs() { String parentHref = "http://parent.com/index.html"; @@ -821,6 +854,7 @@ public class DecorationModelInheritanceAssemblerTest /** * https://issues.apache.org/jira/browse/DOXIASITETOOLS-62 */ + @Test public void testBreadcrumbCutParentAfterDuplicate() { DecorationModel child = new DecorationModel(); // B > E @@ -848,6 +882,7 @@ public class DecorationModelInheritanceAssemblerTest /** * */ + @Test public void testBannerWithoutHref() { DecorationModel model = new DecorationModel(); @@ -859,12 +894,14 @@ public class DecorationModelInheritanceAssemblerTest assembler.resolvePaths( model, "http://foo.apache.org" ); - assertEquals( "Check banner", createBanner( "Left", null, "images/src.gif", "alt" ), model.getBannerLeft() ); + assertEquals( "Check banner", createBanner( "Left", null, "images/src.gif", "alt" ), + model.getBannerLeft() ); } /** * */ + @Test public void testLogoWithoutImage() { // This should actually be validated in the model, it doesn't really make sense diff --git a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/Doxia91Test.java b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/Doxia91Test.java index 5e1c5c5..bcb8585 100644 --- a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/Doxia91Test.java +++ b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/Doxia91Test.java @@ -19,18 +19,20 @@ package org.apache.maven.doxia.site.decoration.inheritance; * under the License. */ -import junit.framework.TestCase; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; /** - * Testcase for DOXIA-91 problems. All tests make sure that a passed in null will not generate any path conversion but + * Tests for DOXIA-91 problems. All tests make sure that a passed in null will not generate any path conversion but * just returns the old path. * * @author <a href="mailto:[email protected]">Henning P. Schmiedehausen</a> */ public class Doxia91Test - extends TestCase { /** @throws Exception */ + @Test public void testOldPathNull() throws Exception { @@ -43,6 +45,7 @@ public class Doxia91Test } /** @throws Exception */ + @Test public void testNewPathNull() throws Exception { @@ -55,6 +58,7 @@ public class Doxia91Test } /** @throws Exception */ + @Test public void testBothPathNull() throws Exception { diff --git a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptorTest.java b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptorTest.java index a0b52ac..3662b72 100644 --- a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptorTest.java +++ b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathDescriptorTest.java @@ -24,7 +24,9 @@ import java.io.File; import org.codehaus.plexus.util.Os; import org.codehaus.plexus.util.StringUtils; -import junit.framework.TestCase; +import org.junit.Test; + +import static org.junit.Assert.*; /** * Test the PathDescriptor creation under various circumstances. @@ -32,9 +34,9 @@ import junit.framework.TestCase; * @author <a href="mailto:[email protected]">Henning P. Schmiedehausen</a> */ public class PathDescriptorTest - extends TestCase { /** @throws Exception */ + @Test public void testAbsPath() throws Exception { @@ -53,6 +55,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testRelPath() throws Exception { @@ -71,6 +74,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testEmptyAbsPath() throws Exception { @@ -89,6 +93,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testEmptyRelPath() throws Exception { @@ -107,6 +112,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testNullPath() throws Exception { @@ -125,6 +131,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testNullBaseAbsPath() throws Exception { @@ -144,6 +151,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testNullBaseRelPath() throws Exception { @@ -163,6 +171,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testNullBaseEmptyAbsPath() throws Exception { @@ -182,6 +191,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testNullBaseEmptyRelPath() throws Exception { @@ -201,6 +211,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testNullBaseNullPath() throws Exception { @@ -220,6 +231,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testUrlBaseAbsPath() throws Exception { @@ -239,6 +251,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testUrlBaseRelPath() throws Exception { @@ -258,6 +271,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testUrlBaseEmptyAbsPath() throws Exception { @@ -277,6 +291,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testUrlBaseEmptyRelPath() throws Exception { @@ -296,6 +311,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testUrlBaseNullPath() throws Exception { @@ -315,6 +331,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testFileBaseAbsPath() throws Exception { @@ -343,6 +360,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testFileBaseRelPath() throws Exception { @@ -371,6 +389,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testFileBaseEmptyAbsPath() throws Exception { @@ -399,6 +418,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testFileBaseEmptyRelPath() throws Exception { @@ -427,6 +447,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testFileBaseNullPath() throws Exception { @@ -467,6 +488,7 @@ public class PathDescriptorTest */ /** @throws Exception */ + @Test public void testPathBaseAbsPath() throws Exception { @@ -495,6 +517,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testPathBaseRelPath() throws Exception { @@ -523,6 +546,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testPathBaseEmptyAbsPath() throws Exception { @@ -551,6 +575,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testPathBaseEmptyRelPath() throws Exception { @@ -579,6 +604,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testPathBaseNullPath() throws Exception { @@ -607,6 +633,7 @@ public class PathDescriptorTest } /** @throws Exception */ + @Test public void testPathRelBase() throws Exception { diff --git a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathUtilsTest.java b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathUtilsTest.java index adfce50..06130c5 100644 --- a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathUtilsTest.java +++ b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/PathUtilsTest.java @@ -21,18 +21,21 @@ package org.apache.maven.doxia.site.decoration.inheritance; import java.io.File; -import junit.framework.TestCase; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; /** * * @author ltheussl */ public class PathUtilsTest - extends TestCase { private static final String SLASH = File.separator; /** @throws Exception */ + @Test public void testConvertPath() throws Exception { @@ -43,13 +46,13 @@ public class PathUtilsTest } /** @throws Exception */ + @Test public void testGetRelativePath() throws Exception { PathDescriptor oldPath = new PathDescriptor( "/tmp/foo", "base" ); PathDescriptor newPath = new PathDescriptor( "/tmp", "target" ); - assertEquals( ".." + SLASH + ".." + SLASH + "target", - PathUtils.getRelativePath( oldPath, newPath ) ); + assertEquals( ".." + SLASH + ".." + SLASH + "target", PathUtils.getRelativePath( oldPath, newPath ) ); oldPath = new PathDescriptor( (String) null, "base" ); assertNull( PathUtils.getRelativePath( oldPath, newPath ) ); @@ -61,6 +64,7 @@ public class PathUtilsTest } /** @throws Exception */ + @Test public void testRelativePathScpBase() throws Exception { diff --git a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java index f2ce190..d767892 100644 --- a/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java +++ b/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java @@ -22,7 +22,9 @@ package org.apache.maven.doxia.site.decoration.inheritance; import java.net.URI; -import junit.framework.TestCase; +import org.junit.Test; + +import static org.junit.Assert.*; /** * @@ -31,7 +33,6 @@ import junit.framework.TestCase; * @since 1.2 */ public class URIPathDescriptorTest - extends TestCase { private static final String BASE_URL = "http://maven.apache.org/"; @@ -40,6 +41,7 @@ public class URIPathDescriptorTest * * @throws Exception */ + @Test public void testConstructor() throws Exception { @@ -92,6 +94,7 @@ public class URIPathDescriptorTest * * @throws Exception */ + @Test public void testResolveLink() throws Exception { @@ -135,13 +138,15 @@ public class URIPathDescriptorTest * * @throws Exception */ + @Test public void testRebaseLink() throws Exception { URIPathDescriptor oldPath = new URIPathDescriptor( BASE_URL, "source" ); assertEquals( "../source", oldPath.rebaseLink( "http://maven.apache.org/doxia/" ).toString() ); assertEquals( "http://maven.apache.org/source", oldPath.rebaseLink( null ).toString() ); - assertEquals( "http://maven.apache.org/source", oldPath.rebaseLink( "C:/Documents and Settings/" ).toString() ); + assertEquals( "http://maven.apache.org/source", + oldPath.rebaseLink( "C:/Documents and Settings/" ).toString() ); oldPath = new URIPathDescriptor( BASE_URL, "./" ); assertEquals( "", oldPath.rebaseLink( "http://maven.apache.org/" ).toString() ); @@ -150,11 +155,12 @@ public class URIPathDescriptorTest assertEquals( "", oldPath.rebaseLink( "http://maven.apache.org/" ).toString() ); oldPath = new URIPathDescriptor( BASE_URL, "source/index.html" ); - assertEquals( "../source/index.html", oldPath.rebaseLink( "http://maven.apache.org/doxia/" ).toString() ); + assertEquals( "../source/index.html", + oldPath.rebaseLink( "http://maven.apache.org/doxia/" ).toString() ); oldPath = new URIPathDescriptor( BASE_URL, "source/index.html?var=foo&var2=bar" ); assertEquals( "../source/index.html?var=foo&var2=bar", - oldPath.rebaseLink( "http://maven.apache.org/doxia/" ).toString() ); + oldPath.rebaseLink( "http://maven.apache.org/doxia/" ).toString() ); oldPath = new URIPathDescriptor( "scp://people.apache.org/", "source" ); assertEquals( "../source", oldPath.rebaseLink( "scp://people.apache.org/doxia" ).toString() ); @@ -164,7 +170,7 @@ public class URIPathDescriptorTest oldPath = new URIPathDescriptor( BASE_URL, "index.html?var=foo&var2=bar" ); assertEquals( "../index.html?var=foo&var2=bar", - oldPath.rebaseLink( "http://maven.apache.org/doxia/" ).toString() ); + oldPath.rebaseLink( "http://maven.apache.org/doxia/" ).toString() ); oldPath = new URIPathDescriptor( "http://jakarta.apache.org/", "banner/left" ); assertEquals( "http://jakarta.apache.org/banner/left", oldPath.rebaseLink( BASE_URL ).toString() ); @@ -174,13 +180,16 @@ public class URIPathDescriptorTest assertEquals( "../user", oldPath.rebaseLink( "file:/Users/target" ).toString() ); oldPath = new URIPathDescriptor( "file:///C:/Documents%20and%20Settings/", "source" ); - assertEquals( "../source", oldPath.rebaseLink( "file:///C:/Documents%20and%20Settings/target" ).toString() ); + assertEquals( "../source", + oldPath.rebaseLink( "file:///C:/Documents%20and%20Settings/target" ).toString() ); oldPath = new URIPathDescriptor( "file://C:/Documents%20and%20Settings/", "source" ); - assertEquals( "../source", oldPath.rebaseLink( "file://C:/Documents%20and%20Settings/target" ).toString() ); + assertEquals( "../source", + oldPath.rebaseLink( "file://C:/Documents%20and%20Settings/target" ).toString() ); oldPath = new URIPathDescriptor( "file:/C:/Documents%20and%20Settings/", "source" ); - assertEquals( "../source", oldPath.rebaseLink( "file:/C:/Documents%20and%20Settings/target" ).toString() ); + assertEquals( "../source", + oldPath.rebaseLink( "file:/C:/Documents%20and%20Settings/target" ).toString() ); } /** @@ -188,6 +197,7 @@ public class URIPathDescriptorTest * * @throws Exception */ + @Test public void testRelativizeLink() throws Exception { @@ -239,6 +249,7 @@ public class URIPathDescriptorTest * * @throws Exception */ + @Test public void testSameSite() throws Exception { diff --git a/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java b/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java index 46e9794..dcb1a5b 100644 --- a/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java +++ b/doxia-doc-renderer/src/test/java/org/apache/maven/doxia/docrenderer/DocumentRendererTest.java @@ -86,7 +86,6 @@ public class DocumentRendererTest renderAggregatedImpl( "itext" ); } - @SuppressWarnings ( "unchecked" ) private void renderImpl( String implementation ) throws Exception { @@ -102,7 +101,6 @@ public class DocumentRendererTest docRenderer.render( siteDirectoryFile, outputDirectory, null ); - @SuppressWarnings ( "unchecked" ) List<String> files = FileUtils.getFileNames( new File( siteDirectoryFile, "apt" ), "**/*.apt", FileUtils.getDefaultExcludesAsString(), false ); diff --git a/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/DefaultSiteToolTest.java b/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/DefaultSiteToolTest.java index d80a8bc..0d54c5b 100644 --- a/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/DefaultSiteToolTest.java +++ b/doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/DefaultSiteToolTest.java @@ -19,20 +19,23 @@ package org.apache.maven.doxia.tools; * under the License. */ -import junit.framework.TestCase; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; /** * @author <a href="mailto:[email protected]">Vincent Siveton</a> */ public class DefaultSiteToolTest - extends TestCase { /** * test getNormalizedPath(). */ + @Test public void testGetNormalizedPath() { - assertEquals( null, DefaultSiteTool.getNormalizedPath( null ) ); + assertNull( DefaultSiteTool.getNormalizedPath( null ) ); assertEquals( "", DefaultSiteTool.getNormalizedPath( "" ) ); assertEquals( "", DefaultSiteTool.getNormalizedPath( "." ) ); assertEquals( "", DefaultSiteTool.getNormalizedPath( "./" ) ); @@ -50,6 +53,7 @@ public class DefaultSiteToolTest assertEquals( "index.html", DefaultSiteTool.getNormalizedPath( "./foo/../index.html" ) ); // note: space is preserved and double slash is removed! - assertEquals( "file:/Documents and Settings/", DefaultSiteTool.getNormalizedPath( "file://Documents and Settings/" ) ); + assertEquals( "file:/Documents and Settings/", + DefaultSiteTool.getNormalizedPath( "file://Documents and Settings/" ) ); } } diff --git a/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AttributesVerifier.java b/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AttributesVerifier.java index 852016f..0865d92 100644 --- a/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AttributesVerifier.java +++ b/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AttributesVerifier.java @@ -98,7 +98,7 @@ public class AttributesVerifier assertEquals( "Project", img.getAttribute( "alt" ) ); // test object identity to distinguish the case ATTRIBUTE_VALUE_EMPTY - assertTrue( img.getAttribute( "dummy" ) == HtmlElement.ATTRIBUTE_NOT_DEFINED ); + assertSame( img.getAttribute( "dummy" ), HtmlElement.ATTRIBUTE_NOT_DEFINED ); HtmlTable table = (HtmlTable) elementIterator.next(); assertEquals( "1", table.getAttribute( "border" ) ); diff --git a/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java b/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java index 718fb4c..0195bd2 100644 --- a/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java +++ b/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java @@ -70,7 +70,6 @@ public class EntitiesVerifier author = (HtmlMeta) page.getElementsByName( "author" ).get( 4 ); assertNotNull( author ); - assertTrue( author.getContentAttribute().equals( "Apostrophe '" ) ); assertEquals( "Apostrophe '", author.getContentAttribute() ); author = (HtmlMeta) page.getElementsByName( "author" ).get( 5 ); diff --git a/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/SkinResourceLoaderTest.java b/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/SkinResourceLoaderTest.java index d34fdbe..6f7a5e9 100644 --- a/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/SkinResourceLoaderTest.java +++ b/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/SkinResourceLoaderTest.java @@ -23,16 +23,17 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import junit.framework.TestCase; - import org.apache.maven.doxia.sink.impl.AbstractSink; import org.codehaus.plexus.util.IOUtil; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; public class SkinResourceLoaderTest - extends TestCase { private SkinResourceLoader skinResourceLoader = new SkinResourceLoader(); + @Test public void testNormalizeNewline() throws Exception { String EOL = AbstractSink.EOL; diff --git a/pom.xml b/pom.xml index 7325868..340f12e 100644 --- a/pom.xml +++ b/pom.xml @@ -185,7 +185,7 @@ under the License. <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>3.8.2</version> + <version>4.13</version> </dependency> </dependencies> </dependencyManagement>
