creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1337943 [1/2] - in /creadur/main/trunk: apache-rat-core/src/test/java/org/apache/rat/ apache-rat-core/src/test/java/org/apache/rat/analysis/ apache-rat-core/src/test/java/org/apache/rat/analysis/generation/ apache-rat-core/src/test/java/or...
Date Sun, 13 May 2012 17:22:22 GMT
Author: rdonkin
Date: Sun May 13 17:22:20 2012
New Revision: 1337943

URL: http://svn.apache.org/viewvc?rev=1337943&view=rev
Log:
(Apache Rat) RAT-115 Migrate tests to junit4. Many thanks to Hugo Hirsch for the patch.

Modified:
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTransformerTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/HeaderCheckWorkerTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/MockLicenseMatcher.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/generation/GeneratedLicenseNotRequiredTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/generation/JavaDocLicenseNotRequiredTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/ApacheSoftwareLicense20Test.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/GPL123LicenseTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/MITLicenseTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/OASISLicenseTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/W3CLicenseTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/annotation/TestLicenceAppender.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/MockDocumentAnalyser.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/ToNameTransformerTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/SingularFileDocumentTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/ArchiveGuesserTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/BinaryGuesserTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/GuessUtilsTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/NoteGuesserTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/ArrayCharFilterTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/FilteringSequenceFactoryTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/HeaderMatcherTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/HeaderMatcherWithBeansTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/SimpleCharFilter.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlUtils.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/writer/XmlWriterUtilsTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/writer/impl/base/XmlWriterTest.java
    creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/walker/FileNameComparatorTest.java
    creadur/main/trunk/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java
    creadur/main/trunk/apache-rat-tasks/src/test/java/org/apache/rat/anttasks/AbstractRatAntTaskTest.java

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java Sun May 13 17:22:20 2012
@@ -18,16 +18,18 @@
  */ 
 package org.apache.rat;
 
+import org.apache.rat.analysis.util.HeaderMatcherMultiplexer;
+import org.apache.rat.test.utils.Resources;
+import org.apache.rat.walker.DirectoryWalker;
+import org.junit.Test;
+
 import java.io.File;
 import java.io.StringWriter;
 
-import junit.framework.TestCase;
-
-import org.apache.rat.walker.DirectoryWalker;
-import org.apache.rat.analysis.util.HeaderMatcherMultiplexer;
-import org.apache.rat.test.utils.Resources;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
-public class ReportTest extends TestCase {
+public class ReportTest {
     private static final String HEADER =
             "\n" + 
             "*****************************************************\n" + 
@@ -102,15 +104,8 @@ public class ReportTest extends TestCase
             "\n";
 	}
     
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    public void testPlainReport() throws Exception {
+    @Test
+    public void plainReport() throws Exception {
         StringWriter out = new StringWriter();
         HeaderMatcherMultiplexer matcherMultiplexer = new HeaderMatcherMultiplexer(Defaults.DEFAULT_MATCHERS);
         final String elementsPath = Resources.getResourceDirectory("elements/Source.java");

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTransformerTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTransformerTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTransformerTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTransformerTest.java Sun May 13 17:22:20 2012
@@ -18,15 +18,17 @@
  */ 
 package org.apache.rat;
 
+import org.junit.Test;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
 import java.io.StringReader;
 import java.io.StringWriter;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertNotNull;
 
-public class ReportTransformerTest extends TestCase {
+public class ReportTransformerTest {
     
     private static final String SIMPLE_CONTENT =  
         "<?xml version='1.0'?>" +
@@ -37,18 +39,10 @@ public class ReportTransformerTest exten
         "<directory name='.svn' restricted='true'/>" +
         "</directory>";
 
-    StringWriter writer;
-    
-    protected void setUp() throws Exception {
-        super.setUp();
-        writer = new StringWriter();
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
+    @Test
     public void testTransform() throws Exception {
+        StringWriter writer = new StringWriter();
+        assertNotNull(writer);
         StringReader in = new StringReader(SIMPLE_CONTENT);
         ReportTransformer transformer = new ReportTransformer(writer, 
                 new BufferedReader(new FileReader(new File("src/main/resources/org/apache/rat/plain-rat.xsl"))), 

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java Sun May 13 17:22:20 2012
@@ -18,28 +18,27 @@
  */ 
 package org.apache.rat.analysis;
 
-import java.io.File;
-import java.io.StringWriter;
-
-import junit.framework.TestCase;
-
-import org.apache.rat.analysis.DefaultAnalyserFactory;
-import org.apache.rat.analysis.IHeaderMatcher;
-import org.apache.rat.analysis.RatHeaderAnalysisException;
 import org.apache.rat.api.Document;
 import org.apache.rat.document.IDocumentAnalyser;
 import org.apache.rat.document.impl.MonolithicFileDocument;
 import org.apache.rat.report.claim.impl.xml.SimpleXmlClaimReporter;
 import org.apache.rat.report.xml.writer.impl.base.XmlWriter;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.StringWriter;
+
+import static org.junit.Assert.assertEquals;
 
-public class AnalyserFactoryTest extends TestCase {
+public class AnalyserFactoryTest {
 
     StringWriter out;
     SimpleXmlClaimReporter reporter;
     IHeaderMatcher matcherStub;
-    
-    protected void setUp() throws Exception {
-        super.setUp();
+
+    @Before
+    public void setUp() throws Exception {
         out = new StringWriter();
         XmlWriter writer = new XmlWriter(out);
         reporter = new SimpleXmlClaimReporter(writer);
@@ -54,12 +53,8 @@ public class AnalyserFactoryTest extends
         };
      }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-
-    public void testStandardTypeAnalyser() throws Exception {
+    @Test
+    public void standardTypeAnalyser() throws Exception {
         MonolithicFileDocument document = new MonolithicFileDocument(new File("src/test/resources/elements/Text.txt"));
         IDocumentAnalyser analyser = DefaultAnalyserFactory.createDefaultAnalyser(matcherStub);
         analyser.analyse(document);
@@ -87,7 +82,8 @@ public class AnalyserFactoryTest extends
                 "</header-sample><header-type name='?????'/><license-family name='?????'/><type name='standard'/>", out.toString());
     }
 
-    public void testNoteTypeAnalyser() throws Exception {
+    @Test
+    public void noteTypeAnalyser() throws Exception {
         MonolithicFileDocument document = new MonolithicFileDocument(new File("src/test/elements/LICENSE"));
         IDocumentAnalyser analyser = DefaultAnalyserFactory.createDefaultAnalyser(matcherStub);
         analyser.analyse(document);
@@ -95,7 +91,8 @@ public class AnalyserFactoryTest extends
         assertEquals("Open note element", "<resource name='src/test/elements/LICENSE'><type name='notice'/>", out.toString());
     }
 
-    public void testBinaryTypeAnalyser() throws Exception {
+    @Test
+    public void binaryTypeAnalyser() throws Exception {
         MonolithicFileDocument document = new MonolithicFileDocument(new File("src/test/elements/Image.png"));
         IDocumentAnalyser analyser = DefaultAnalyserFactory.createDefaultAnalyser(matcherStub);
         analyser.analyse(document);
@@ -103,7 +100,8 @@ public class AnalyserFactoryTest extends
         assertEquals("Open binary element", "<resource name='src/test/elements/Image.png'><type name='binary'/>", out.toString());
     }
 
-    public void testArchiveTypeAnalyser() throws Exception {
+    @Test
+    public void archiveTypeAnalyser() throws Exception {
         MonolithicFileDocument document = new MonolithicFileDocument(new File("src/test/elements/Dummy.jar"));
         IDocumentAnalyser analyser = DefaultAnalyserFactory.createDefaultAnalyser(matcherStub);
         analyser.analyse(document);

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/HeaderCheckWorkerTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/HeaderCheckWorkerTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/HeaderCheckWorkerTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/HeaderCheckWorkerTest.java Sun May 13 17:22:20 2012
@@ -19,26 +19,20 @@
 
 package org.apache.rat.analysis;
 
-import java.io.StringReader;
-
-import junit.framework.TestCase;
-
-import org.apache.rat.analysis.HeaderCheckWorker;
 import org.apache.rat.analysis.license.ApacheSoftwareLicense20;
 import org.apache.rat.api.Document;
 import org.apache.rat.document.MockLocation;
+import org.junit.Test;
 
-public class HeaderCheckWorkerTest extends TestCase {
-    
-	protected void setUp() throws Exception {
-		super.setUp();
-	}
+import java.io.StringReader;
 
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-	
-	public void testIsFinished() throws Exception {
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class HeaderCheckWorkerTest {
+
+    @Test
+	public void isFinished() throws Exception {
         final Document subject = new MockLocation("subject");
 		HeaderCheckWorker worker = new HeaderCheckWorker(new StringReader(""), new ApacheSoftwareLicense20(), subject);
 		assertFalse(worker.isFinished());

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/MockLicenseMatcher.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/MockLicenseMatcher.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/MockLicenseMatcher.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/MockLicenseMatcher.java Sun May 13 17:22:20 2012
@@ -18,14 +18,14 @@
  */ 
 package org.apache.rat.analysis;
 
+import org.apache.rat.api.Document;
+
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.rat.api.Document;
-
 public class MockLicenseMatcher implements IHeaderMatcher {
 
-	public final List lines = new ArrayList();
+	public final List<String> lines = new ArrayList<String>();
 	public int resets = 0;
     public boolean result = true;
 	

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/generation/GeneratedLicenseNotRequiredTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/generation/GeneratedLicenseNotRequiredTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/generation/GeneratedLicenseNotRequiredTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/generation/GeneratedLicenseNotRequiredTest.java Sun May 13 17:22:20 2012
@@ -18,31 +18,31 @@
  */ 
 package org.apache.rat.analysis.generation;
 
-import java.util.regex.Pattern;
-
-import junit.framework.TestCase;
-
 import org.apache.rat.api.Document;
 import org.apache.rat.document.MockLocation;
 import org.apache.rat.report.claim.impl.xml.MockClaimReporter;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.regex.Pattern;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
-public class GeneratedLicenseNotRequiredTest extends TestCase {
+public class GeneratedLicenseNotRequiredTest {
 
     GeneratedLicenseNotRequired license;
     MockClaimReporter reporter;
     
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         Pattern[] patterns = {Pattern.compile(".*Generated")};
         license = new GeneratedLicenseNotRequired(patterns);
         reporter = new MockClaimReporter();
     }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    public void testMatch() throws Exception {
+    @Test
+    public void match() throws Exception {
         final Document subject = new MockLocation("subject");
         assertFalse("Does not match regex", license.match(subject, "Not at all"));
         assertTrue("Matches regex", license.match(subject, "This is Generated"));

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/generation/JavaDocLicenseNotRequiredTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/generation/JavaDocLicenseNotRequiredTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/generation/JavaDocLicenseNotRequiredTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/generation/JavaDocLicenseNotRequiredTest.java Sun May 13 17:22:20 2012
@@ -18,43 +18,45 @@
  */ 
 package org.apache.rat.analysis.generation;
 
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-
-import junit.framework.TestCase;
-
 import org.apache.rat.api.Document;
 import org.apache.rat.document.MockLocation;
 import org.apache.rat.report.claim.impl.xml.MockClaimReporter;
 import org.apache.rat.test.utils.Resources;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
 
-public class JavaDocLicenseNotRequiredTest extends TestCase {
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class JavaDocLicenseNotRequiredTest {
 
     MockClaimReporter reporter;
     JavaDocLicenseNotRequired license;
     
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         license = new JavaDocLicenseNotRequired();
         reporter = new MockClaimReporter();
     }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-    
-    public void testMatchIndexDoc() throws Exception {
+    @Test
+    public void matchIndexDoc() throws Exception {
         boolean result = readAndMatch("index.html");
         assertTrue("Is a javadoc", result);
     }
 
-    public void testMatchClassDoc() throws Exception {
+    @Test
+    public void matchClassDoc() throws Exception {
         boolean result = readAndMatch("ArchiveElement.html");
         assertTrue("Is a javadoc", result);
     }
 
-    public void testMatchNonJavaDoc() throws Exception {
+    @Test
+    public void matchNonJavaDoc() throws Exception {
         boolean result = readAndMatch("notjavadoc.html");
         assertFalse("Not javadocs and so should return null", result);
     }

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/ApacheSoftwareLicense20Test.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/ApacheSoftwareLicense20Test.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/ApacheSoftwareLicense20Test.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/ApacheSoftwareLicense20Test.java Sun May 13 17:22:20 2012
@@ -18,26 +18,26 @@
  */ 
 package org.apache.rat.analysis.license;
 
-import junit.framework.TestCase;
-
 import org.apache.rat.api.Document;
 import org.apache.rat.document.MockLocation;
 import org.apache.rat.report.claim.impl.xml.MockClaimReporter;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
-public class ApacheSoftwareLicense20Test extends TestCase {
+public class ApacheSoftwareLicense20Test {
 
     MockClaimReporter reporter;
-    
-	protected void setUp() throws Exception {
-		super.setUp();
+
+    @Before
+	public void setUp() throws Exception {
         reporter = new MockClaimReporter();
 	}
 
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-	
-	public void testMatches() throws Exception {
+	@Test
+    public void matches() throws Exception {
 		ApacheSoftwareLicense20 worker = new ApacheSoftwareLicense20();
 		assertTrue(worker.matches(ApacheSoftwareLicense20.FIRST_LICENSE_LINE));
 		assertTrue(worker.matches("    Licensed under the Apache License, Version 2.0 (the \"License\");"));
@@ -51,7 +51,8 @@ public class ApacheSoftwareLicense20Test
 		assertFalse(worker.matches("'Behold, Telemachus! (nor fear the sight,)"));
 	}
 	
-	public void testMatch() throws Exception {
+	@Test
+    public void match() throws Exception {
 		ApacheSoftwareLicense20 worker = new ApacheSoftwareLicense20();
 		final Document subject = new MockLocation("subject");
 		assertTrue(worker.match(subject, ApacheSoftwareLicense20.FIRST_LICENSE_LINE));

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/GPL123LicenseTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/GPL123LicenseTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/GPL123LicenseTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/GPL123LicenseTest.java Sun May 13 17:22:20 2012
@@ -23,7 +23,6 @@ import org.apache.rat.api.Document;
 import org.apache.rat.document.MockLocation;
 import org.apache.rat.report.claim.impl.xml.MockClaimReporter;
 import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
 import java.util.HashMap;
@@ -45,8 +44,11 @@ public class GPL123LicenseTest {
      */
     private static Map<IHeaderMatcher, String> licenseStringMap;
 
-    @BeforeClass
-    public static void initLicencesUnderTest() {
+    /**
+     * If you replace this with BeforeClass and make this method static the build fails at line 67.
+     */
+    @Before
+    public void initLicencesUnderTest() {
         licenseStringMap = new HashMap<IHeaderMatcher, String>();
         licenseStringMap.put(new GPL1License(), GPL1License.FIRST_LICENSE_LINE);
         licenseStringMap.put(new GPL2License(), GPL2License.FIRST_LICENSE_LINE);

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/MITLicenseTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/MITLicenseTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/MITLicenseTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/MITLicenseTest.java Sun May 13 17:22:20 2012
@@ -23,7 +23,6 @@ import org.apache.rat.api.Document;
 import org.apache.rat.document.MockLocation;
 import org.apache.rat.report.claim.impl.xml.MockClaimReporter;
 import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
 import java.util.HashMap;
@@ -46,8 +45,11 @@ public class MITLicenseTest {
      */
     private static Map<IHeaderMatcher, String> licenseStringMap;
 
-    @BeforeClass
-    public static void initLicencesUnderTest() {
+    /**
+     * If you replace this with BeforeClass and make this method static the build fails at line 71.
+     */
+    @Before
+    public void initLicencesUnderTest() {
         licenseStringMap = new HashMap<IHeaderMatcher, String>();
         licenseStringMap.put(new MITLicense(),
                              MITLicense.FIRST_LICENSE_LINE
@@ -85,6 +87,5 @@ public class MITLicenseTest {
             assertTrue(licenceUnderTest.getKey().match(subject, " ## " + licenceUnderTest.getValue() + " ##"));
         }
     }
-    
-    
+
 }

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/OASISLicenseTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/OASISLicenseTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/OASISLicenseTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/OASISLicenseTest.java Sun May 13 17:22:20 2012
@@ -18,17 +18,20 @@
  */ 
 package org.apache.rat.analysis.license;
 
-import java.io.BufferedReader;
-import java.io.StringReader;
-
-import junit.framework.TestCase;
-
 import org.apache.rat.api.Document;
 import org.apache.rat.document.MockLocation;
 import org.apache.rat.report.claim.impl.xml.MockClaimReporter;
 import org.apache.rat.test.utils.Resources;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.BufferedReader;
+import java.io.StringReader;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
-public class OASISLicenseTest extends TestCase {
+public class OASISLicenseTest {
     
     private static final String LICENSE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
             "<!--\n" +
@@ -54,17 +57,14 @@ public class OASISLicenseTest extends Te
     
     MockClaimReporter reporter;
 
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         license = new OASISLicense();
         reporter = new MockClaimReporter();
     }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    public void testMatch() throws Exception {
+    @Test
+    public void match() throws Exception {
         BufferedReader in = new BufferedReader(new StringReader(LICENSE));
         String line = in.readLine();
         boolean result = false;
@@ -79,7 +79,8 @@ public class OASISLicenseTest extends Te
         assertFalse("After reset, content should build up again", result);
     }
 
-    public void testNoMatch() throws Exception {
+    @Test
+    public void noMatch() throws Exception {
         BufferedReader in = Resources.getBufferedResourceReader("elements/Source.java");
         String line = in.readLine();
         boolean result = false;

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/W3CLicenseTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/W3CLicenseTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/W3CLicenseTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/license/W3CLicenseTest.java Sun May 13 17:22:20 2012
@@ -18,13 +18,16 @@
  */ 
 package org.apache.rat.analysis.license;
 
-import junit.framework.TestCase;
-
 import org.apache.rat.api.Document;
 import org.apache.rat.document.MockLocation;
 import org.apache.rat.report.claim.impl.xml.MockClaimReporter;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
-public class W3CLicenseTest extends TestCase {
+public class W3CLicenseTest {
 
     public static final String COPYRIGHT_URL 
     = "http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231";
@@ -37,22 +40,20 @@ public class W3CLicenseTest extends Test
     
     W3CLicense license;
     MockClaimReporter reporter;
-    
-    protected void setUp() throws Exception {
-        super.setUp();
+
+    @Before
+    public void setUp() throws Exception {
         license = new W3CLicense();
         reporter = new MockClaimReporter();
     }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    public void testMatch() throws Exception {
+    @Test
+    public void match() throws Exception {
         final Document subject = new MockLocation("subject");
         assertTrue("Expected matcher to return license", license.match(subject, COPYRIGHT_URL));
         assertTrue("Expected matcher to return license", license.match(subject, COPYRIGHT_URL_COMMENTED));
         assertTrue("Expected matcher to return license", license.match(subject, COPYRIGHT_URL_XML));
         assertFalse("Return null if the license isn't matched", license.match(subject, "Bogus"));
     }
+
 }

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/annotation/TestLicenceAppender.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/annotation/TestLicenceAppender.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/annotation/TestLicenceAppender.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/annotation/TestLicenceAppender.java Sun May 13 17:22:20 2012
@@ -18,6 +18,9 @@
  */ 
 package org.apache.rat.annotation;
 
+import org.apache.rat.test.utils.Resources;
+import org.junit.Test;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
@@ -26,11 +29,10 @@ import java.io.IOException;
 import java.io.Writer;
 import java.util.Random;
 
-import junit.framework.TestCase;
-
-import org.apache.rat.test.utils.Resources;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 
-public class TestLicenceAppender extends TestCase {
+public class TestLicenceAppender {
     /** Used to ensure that temporary files have unq */
     private Random random = new Random();
 
@@ -110,7 +112,8 @@ public class TestLicenceAppender extends
         };
     }
 
-    public void testAddLicenceToUnknownFile() throws IOException {
+    @Test
+    public void addLicenceToUnknownFile() throws IOException {
         String filename = qualify("tmp" + random.nextLong()
                                   + ".unknownType");
         File file = null;
@@ -137,7 +140,8 @@ public class TestLicenceAppender extends
         }
     }
 
-    public void testAddLicenceToJava() throws IOException {
+    @Test
+    public void addLicenceToJava() throws IOException {
         String filename = "tmp.java";
         final String firstLine = "package foo;";
         String secondLine = "/*";
@@ -153,7 +157,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, secondLine));
     }
 
-    public void testAddLicenceToJavaWithoutPackage() throws IOException {
+    @Test
+    public void addLicenceToJavaWithoutPackage() throws IOException {
         String filename = "tmp.java";
         String commentLine = "/*";
         commonTestTemplate(filename, new FileCreator() {
@@ -166,7 +171,8 @@ public class TestLicenceAppender extends
             checkLines(commentLine, null));
     }
 
-    public void testAddLicenceToXML() throws IOException {
+    @Test
+    public void addLicenceToXML() throws IOException {
         String filename = "tmp.xml";
         final String firstLine = "<?xml version='1.0'?>";
         final String secondLine = "<!--";
@@ -183,7 +189,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, secondLine));
     }
 
-    public void testAddLicenceToXMLWithoutDecl() throws IOException {
+    @Test
+    public void addLicenceToXMLWithoutDecl() throws IOException {
         String filename = "tmp.xml";
         final String firstLine = "<?xml version='1.0'?>";
         final String secondLine = "<!--";
@@ -198,7 +205,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, secondLine));
     }
 
-    public void testAddLicenceToHTML() throws IOException {
+    @Test
+    public void addLicenceToHTML() throws IOException {
         String filename = "tmp.html";
         String commentLine = "<!--";
 
@@ -213,7 +221,8 @@ public class TestLicenceAppender extends
             checkLines(commentLine, null));
     }
 
-    public void testAddLicenceToCSS() throws IOException {
+    @Test
+    public void addLicenceToCSS() throws IOException {
         String filename = "tmp.css";
         String firstLine = "/*";
 
@@ -228,7 +237,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, null));
     }
 
-    public void testAddLicenceToJavascript() throws IOException {
+    @Test
+    public void addLicenceToJavascript() throws IOException {
         String filename = "tmp.js";
         String firstLine = "/*";
 
@@ -243,7 +253,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, null));
     }
 
-    public void testAddLicenceToAPT() throws IOException {
+    @Test
+    public void addLicenceToAPT() throws IOException {
         String filename = "tmp.apt";
         String firstLine = "~~";
 
@@ -258,7 +269,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, null));
     }
 
-    public void testAddLicenceToProperties() throws IOException {
+    @Test
+    public void addLicenceToProperties() throws IOException {
         String filename = "tmp.properties";
         String firstLine = "#";
 
@@ -273,7 +285,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, null));
     }
 
-    public void testAddLicenceToScala() throws IOException {
+    @Test
+    public void addLicenceToScala() throws IOException {
         String filename = "tmp.scala";
         final String firstLine = "package foo {";
         final String newFirstLine = "/*";
@@ -305,7 +318,8 @@ public class TestLicenceAppender extends
             });
     }
 
-    public void testAddLicenseToRubyWithoutHashBang()
+    @Test
+    public void addLicenseToRubyWithoutHashBang()
         throws IOException {
         String filename = "tmp.rb";
         String firstLine = "#";
@@ -320,7 +334,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, null));
     }
 
-    public void testAddLicenseToRubyWithHashBang() throws IOException {
+    @Test
+    public void addLicenseToRubyWithHashBang() throws IOException {
         String filename = "tmp.rb";
         final String firstLine = "#!/usr/bin/env ruby";
         String secondLine = "#";
@@ -336,7 +351,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, secondLine));
     }
 
-    public void testAddLicenseToPerlWithoutHashBang()
+    @Test
+    public void addLicenseToPerlWithoutHashBang()
         throws IOException {
         String filename = "tmp.pl";
         String firstLine = "#";
@@ -350,7 +366,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, null));
     }
 
-    public void testAddLicenseToPerlWithHashBang() throws IOException {
+    @Test
+    public void addLicenseToPerlWithHashBang() throws IOException {
         String filename = "tmp.pl";
         final String firstLine = "#!/usr/bin/env perl";
         String secondLine = "#";
@@ -365,7 +382,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, secondLine));
     }
 
-    public void testAddLicenseToTclWithoutHashBang()
+    @Test
+    public void addLicenseToTclWithoutHashBang()
         throws IOException {
         String filename = "tmp.tcl";
         String firstLine = "#";
@@ -379,7 +397,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, null));
     }
 
-    public void testAddLicenseToTclWithHashBang() throws IOException {
+    @Test
+    public void addLicenseToTclWithHashBang() throws IOException {
         String filename = "tmp.tcl";
         final String firstLine = "#!/usr/bin/env tcl";
         String secondLine = "#";
@@ -394,7 +413,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, secondLine));
     }
 
-    public void testAddLicenceToPHP() throws IOException {
+    @Test
+    public void addLicenceToPHP() throws IOException {
         String filename = "tmp.php";
         final String firstLine = "<?php";
         String secondLine = "/*";
@@ -410,7 +430,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, secondLine));
     }
 
-    public void testAddLicenceToCSharp() throws IOException {
+    @Test
+    public void addLicenceToCSharp() throws IOException {
         String filename = "tmp.cs";
         String firstLine = "/*";
 
@@ -426,7 +447,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, null));
     }
 
-    public void testAddLicenceToGroovy() throws IOException {
+    @Test
+    public void addLicenceToGroovy() throws IOException {
         String filename = "tmp.groovy";
         String firstLine = "/*";
 
@@ -441,7 +463,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, null));
     }
 
-    public void testAddLicenceToCPlusPlus() throws IOException {
+    @Test
+    public void addLicenceToCPlusPlus() throws IOException {
         String filename = "tmp.cpp";
         String firstLine = "/*";
 
@@ -457,7 +480,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, null));
     }
 
-    public void testFileWithBOM() throws IOException {
+    @Test
+    public void fileWithBOM() throws IOException {
         File f = Resources.getResourceFile("violations/FilterTest.cs");
         try {
             ApacheV2LicenceAppender appender =
@@ -486,7 +510,8 @@ public class TestLicenceAppender extends
         }
     }
 
-    public void testAddLicenceToVS2003solution() throws IOException {
+    @Test
+    public void addLicenceToVS2003solution() throws IOException {
         String filename = "tmp.sln";
         final String firstLine = "Microsoft Visual Studio Solution File,"
             + " Format Version 8.0";
@@ -507,7 +532,8 @@ public class TestLicenceAppender extends
             checkLines(firstLine, secondLine));
     }
 
-    public void testAddLicenceToVS2005solution() throws IOException {
+    @Test
+    public void addLicenceToVS2005solution() throws IOException {
         String filename = "tmp.sln";
         final String firstLine = "Microsoft Visual Studio Solution File,"
             + " Format Version 9.0";
@@ -542,7 +568,8 @@ public class TestLicenceAppender extends
             });
     }
 
-    public void testAddLicenceToVS2010ExpressSolution() throws IOException {
+    @Test
+    public void addLicenceToVS2010ExpressSolution() throws IOException {
         String filename = "tmp.sln";
         final String firstLine = "Microsoft Visual Studio Solution File, "
             + "Format Version 11.00";
@@ -594,7 +621,8 @@ public class TestLicenceAppender extends
             });
     }
 
-    public void testAddLicenceToVS2010SolutionWithBlankLine() throws IOException {
+    @Test
+    public void addLicenceToVS2010SolutionWithBlankLine() throws IOException {
         String filename = "tmp.sln";
         final String firstLine = "";
         final String secondLine = "Microsoft Visual Studio Solution File, "

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/MockDocumentAnalyser.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/MockDocumentAnalyser.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/MockDocumentAnalyser.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/MockDocumentAnalyser.java Sun May 13 17:22:20 2012
@@ -18,14 +18,14 @@
  */ 
 package org.apache.rat.document;
 
+import org.apache.rat.api.Document;
+
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.rat.api.Document;
-
 public class MockDocumentAnalyser implements IDocumentAnalyser {
 
-    public List matches = new ArrayList();
+    public List<Document> matches = new ArrayList<Document>();
     
     public void analyse(Document document) throws RatDocumentAnalysisException {
         matches.add(document);

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/ToNameTransformerTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/ToNameTransformerTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/ToNameTransformerTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/ToNameTransformerTest.java Sun May 13 17:22:20 2012
@@ -18,28 +18,26 @@
  */ 
 package org.apache.rat.document;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
-public class ToNameTransformerTest extends TestCase {
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+public class ToNameTransformerTest {
 
     ToNameTransformer transformer = new ToNameTransformer();
     
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    public void testTransformLocation() {
+    @Test
+    public void transformLocation() {
         MockLocation location = new MockLocation();
         Object result = transformer.transform(location);
         assertNotNull("Transform into name", result);
         assertEquals("Transform into name", location.name, result);
     }
 
-    public void testTransformNull() {
+    @Test
+    public void transformNull() {
         Object result = transformer.transform(null);
         assertNull("Null transforms to null", result);
     }

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/SingularFileDocumentTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/SingularFileDocumentTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/SingularFileDocumentTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/SingularFileDocumentTest.java Sun May 13 17:22:20 2012
@@ -18,37 +18,38 @@
  */ 
 package org.apache.rat.document.impl;
 
+import org.apache.rat.api.Document;
+import org.apache.rat.test.utils.Resources;
+import org.junit.Before;
+import org.junit.Test;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.Reader;
 
-import junit.framework.TestCase;
-
-import org.apache.rat.api.Document;
-import org.apache.rat.test.utils.Resources;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
-public class SingularFileDocumentTest extends TestCase {
+public class SingularFileDocumentTest {
 	private Document document;
 	private File file;
     
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         file = Resources.getResourceFile("elements/Source.java");
         document = new MonolithicFileDocument(file);
     }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    public void testReader() throws Exception {
+    @Test
+    public void reader() throws Exception {
         Reader reader = document.reader();
         assertNotNull("Reader should be returned", reader);
         assertEquals("First file line expected", "package elements;", 
                  new BufferedReader(reader).readLine());
     }
 
-    public void testGetName() {
+    @Test
+    public void getName() {
         final String name = document.getName();
         assertNotNull("Name is set", name);
         assertEquals("Name is filename", DocumentImplUtils.toName(file), name);

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/ArchiveGuesserTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/ArchiveGuesserTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/ArchiveGuesserTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/ArchiveGuesserTest.java Sun May 13 17:22:20 2012
@@ -19,32 +19,24 @@
 package org.apache.rat.document.impl.guesser;
 
 import org.apache.rat.document.MockDocument;
-import junit.framework.TestCase;
+import org.junit.Test;
 
-public class ArchiveGuesserTest extends TestCase {
+import static org.junit.Assert.assertTrue;
 
-    ArchiveGuesser guesser;
-    
-    protected void setUp() throws Exception {
-        super.setUp();
-        this.guesser = new ArchiveGuesser();
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-    
+public class ArchiveGuesserTest {
 
-    public void testMatches() {
-        assertTrue(guesser.isArchive(new MockDocument("42.jar")));
-        assertTrue(guesser.isArchive(new MockDocument("42.tar.gz")));
-        assertTrue(guesser.isArchive(new MockDocument("42.zip")));
-        assertTrue(guesser.isArchive(new MockDocument("42.tar")));
-        assertTrue(guesser.isArchive(new MockDocument("42.bz")));
-        assertTrue(guesser.isArchive(new MockDocument("42.bz2")));
+    @Test
+    public void matches() {
+        assertTrue(ArchiveGuesser.isArchive(new MockDocument("42.jar")));
+        assertTrue(ArchiveGuesser.isArchive(new MockDocument("42.tar.gz")));
+        assertTrue(ArchiveGuesser.isArchive(new MockDocument("42.zip")));
+        assertTrue(ArchiveGuesser.isArchive(new MockDocument("42.tar")));
+        assertTrue(ArchiveGuesser.isArchive(new MockDocument("42.bz")));
+        assertTrue(ArchiveGuesser.isArchive(new MockDocument("42.bz2")));
     }
     
-    public void testIsArchive() {
+    @Test
+    public void isArchive() {
         assertTrue(ArchiveGuesser.isArchive("42.jar"));
         assertTrue(ArchiveGuesser.isArchive("42.tar.gz"));
         assertTrue(ArchiveGuesser.isArchive("42.zip"));

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/BinaryGuesserTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/BinaryGuesserTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/BinaryGuesserTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/BinaryGuesserTest.java Sun May 13 17:22:20 2012
@@ -18,39 +18,33 @@
  */ 
 package org.apache.rat.document.impl.guesser;
 
+import org.apache.rat.document.MockDocument;
+import org.apache.rat.document.impl.FileDocument;
+import org.junit.Test;
+
 import java.io.File;
 import java.io.IOException;
 import java.io.Reader;
-import org.apache.rat.document.impl.FileDocument;
-import org.apache.rat.document.MockDocument;
-import junit.framework.TestCase;
 
-public class BinaryGuesserTest extends TestCase {
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
-    BinaryGuesser guesser;
-    
-    protected void setUp() throws Exception {
-        super.setUp();
-        guesser = new BinaryGuesser();
-    }
+public class BinaryGuesserTest {
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-    
+    @Test
     public void testMatches() {
-        assertTrue(guesser.isBinary(new MockDocument("image.png")));
-        assertTrue(guesser.isBinary(new MockDocument("image.pdf")));
-        assertTrue(guesser.isBinary(new MockDocument("image.gif")));
-        assertTrue(guesser.isBinary(new MockDocument("image.giff")));
-        assertTrue(guesser.isBinary(new MockDocument("image.tif")));
-        assertTrue(guesser.isBinary(new MockDocument("image.tiff")));
-        assertTrue(guesser.isBinary(new MockDocument("image.jpg")));
-        assertTrue(guesser.isBinary(new MockDocument("image.jpeg")));
-        assertTrue(guesser.isBinary(new MockDocument("image.exe")));
-        assertTrue(guesser.isBinary(new MockDocument("Whatever.class")));
-        assertTrue(guesser.isBinary(new MockDocument("data.dat")));
-        assertTrue(guesser.isBinary(new MockDocument("libicudata.so.34.")));
+        assertTrue(BinaryGuesser.isBinary(new MockDocument("image.png")));
+        assertTrue(BinaryGuesser.isBinary(new MockDocument("image.pdf")));
+        assertTrue(BinaryGuesser.isBinary(new MockDocument("image.gif")));
+        assertTrue(BinaryGuesser.isBinary(new MockDocument("image.giff")));
+        assertTrue(BinaryGuesser.isBinary(new MockDocument("image.tif")));
+        assertTrue(BinaryGuesser.isBinary(new MockDocument("image.tiff")));
+        assertTrue(BinaryGuesser.isBinary(new MockDocument("image.jpg")));
+        assertTrue(BinaryGuesser.isBinary(new MockDocument("image.jpeg")));
+        assertTrue(BinaryGuesser.isBinary(new MockDocument("image.exe")));
+        assertTrue(BinaryGuesser.isBinary(new MockDocument("Whatever.class")));
+        assertTrue(BinaryGuesser.isBinary(new MockDocument("data.dat")));
+        assertTrue(BinaryGuesser.isBinary(new MockDocument("libicudata.so.34.")));
     }
 
     public void testIsBinary() {
@@ -75,7 +69,8 @@ public class BinaryGuesserTest extends T
      *
      * @see RAT-81
      */
-    public void testBinaryWithMalformedInput() throws Throwable {
+    @Test
+    public void binaryWithMalformedInputRAT81() throws Throwable {
         FileDocument doc = new FileDocument(new File("src/test/resources/binaries/UTF16_with_signature.xml"));
         Reader r = null;
         try {
@@ -91,9 +86,11 @@ public class BinaryGuesserTest extends T
             // still here?  can't test on this platform
             System.err.println("Skipping testBinaryWithMalformedInput");
         } catch (IOException e) {
-            r.close();
+            if (r!= null) {
+                r.close();
+            }
             r = null;
-            assertTrue(guesser.isBinary(doc));
+            assertTrue(BinaryGuesser.isBinary(doc));
         } finally {
             if (r != null) {
                 r.close();
@@ -101,15 +98,18 @@ public class BinaryGuesserTest extends T
         }
     }
 
-    public void testRealBinaryContent() {
-        assertTrue(guesser.isBinary(new FileDocument(new File("src/test/resources/binaries/Image-png.not"))));
+    @Test
+    public void realBinaryContent() {
+        assertTrue(BinaryGuesser.isBinary(new FileDocument(new File("src/test/resources/binaries/Image-png.not"))));
     }
 
-    public void testTextualContent() {
-        assertFalse(guesser.isBinary(new FileDocument(new File("src/test/resources/elements/Text.txt"))));
+    @Test
+    public void textualContent() {
+        assertFalse(BinaryGuesser.isBinary(new FileDocument(new File("src/test/resources/elements/Text.txt"))));
     }
 
-    public void testEmptyFile() {
-        assertFalse(guesser.isBinary(new FileDocument(new File("src/test/resources/elements/sub/Empty.txt"))));
+    @Test
+    public void emptyFile() {
+        assertFalse(BinaryGuesser.isBinary(new FileDocument(new File("src/test/resources/elements/sub/Empty.txt"))));
     }
 }

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/GuessUtilsTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/GuessUtilsTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/GuessUtilsTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/GuessUtilsTest.java Sun May 13 17:22:20 2012
@@ -18,19 +18,14 @@
  */ 
 package org.apache.rat.document.impl.guesser;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
-public class GuessUtilsTest extends TestCase {
+import static org.junit.Assert.assertEquals;
 
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
+public class GuessUtilsTest {
 
-    public void testNormalise() throws Exception {
+    @Test
+    public void normalise() throws Exception {
         assertEquals("LICENSE", GuessUtils.normalise("license"));
         assertEquals("LICENSE.TXT", GuessUtils.normalise("license.txt"));
         assertEquals("LICENSE.TXT", GuessUtils.normalise("some/path/license.txt"));

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/NoteGuesserTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/NoteGuesserTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/NoteGuesserTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/NoteGuesserTest.java Sun May 13 17:22:20 2012
@@ -19,31 +19,24 @@
 package org.apache.rat.document.impl.guesser;
 
 import org.apache.rat.document.MockDocument;
-import junit.framework.TestCase;
+import org.junit.Test;
 
-public class NoteGuesserTest extends TestCase {
+import static org.junit.Assert.assertTrue;
 
-    NoteGuesser guesser;
-    
-    protected void setUp() throws Exception {
-        super.setUp();
-        this.guesser = new NoteGuesser();
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
+public class NoteGuesserTest {
 
+    @Test
     public void testMatches() {
-        assertTrue(guesser.isNote(new MockDocument("LICENSE")));
-        assertTrue(guesser.isNote(new MockDocument("LICENSE.txt")));
-        assertTrue(guesser.isNote(new MockDocument("NOTICE")));
-        assertTrue(guesser.isNote(new MockDocument("NOTICE.txt")));
-        assertTrue(guesser.isNote(new MockDocument("README")));
-        assertTrue(guesser.isNote(new MockDocument("README.txt")));
+        assertTrue(NoteGuesser.isNote(new MockDocument("LICENSE")));
+        assertTrue(NoteGuesser.isNote(new MockDocument("LICENSE.txt")));
+        assertTrue(NoteGuesser.isNote(new MockDocument("NOTICE")));
+        assertTrue(NoteGuesser.isNote(new MockDocument("NOTICE.txt")));
+        assertTrue(NoteGuesser.isNote(new MockDocument("README")));
+        assertTrue(NoteGuesser.isNote(new MockDocument("README.txt")));
     }
 
-    public void testIsNote() {
+    @Test
+    public void isNote() {
         assertTrue(NoteGuesser.isNote("LICENSE"));
         assertTrue(NoteGuesser.isNote("LICENSE.txt"));
         assertTrue(NoteGuesser.isNote("NOTICE"));
@@ -52,7 +45,8 @@ public class NoteGuesserTest extends Tes
         assertTrue(NoteGuesser.isNote("README.txt"));
     }
     
-    public void testIsNoteWithPath() {
+    @Test
+    public void isNoteWithPath() {
         assertTrue(NoteGuesser.isNote("src/test/LICENSE"));
         assertTrue(NoteGuesser.isNote("src/test/LICENSE.txt"));
         assertTrue(NoteGuesser.isNote("src/test/NOTICE"));

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/ArrayCharFilterTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/ArrayCharFilterTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/ArrayCharFilterTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/ArrayCharFilterTest.java Sun May 13 17:22:20 2012
@@ -18,23 +18,24 @@
  */ 
 package org.apache.rat.header;
 
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
 
-public class ArrayCharFilterTest extends TestCase {
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class ArrayCharFilterTest {
 
     private static final char[] filtered = {'d', 'o', 'a'};
     ArrayCharFilter filter;
     
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         filter = new ArrayCharFilter(filtered);
     }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    public void testIsFilteredOut() {
+    @Test
+    public void isFilteredOut() {
         assertTrue(filter.isFilteredOut('a'));
         assertFalse(filter.isFilteredOut('b'));
         assertFalse(filter.isFilteredOut('c'));

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/FilteringSequenceFactoryTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/FilteringSequenceFactoryTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/FilteringSequenceFactoryTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/FilteringSequenceFactoryTest.java Sun May 13 17:22:20 2012
@@ -18,28 +18,29 @@
  */ 
 package org.apache.rat.header;
 
+import org.junit.Before;
+import org.junit.Test;
+
 import java.io.StringReader;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
-public class FilteringSequenceFactoryTest extends TestCase {
+public class FilteringSequenceFactoryTest {
 
     int capacity;
     FilteringSequenceFactory factory;
     SimpleCharFilter filter;
-    
-    protected void setUp() throws Exception {
-        super.setUp();
+
+    @Before
+    public void setUp() throws Exception {
         capacity = 50;
         filter = new SimpleCharFilter();
         factory = new FilteringSequenceFactory(capacity, filter);
     }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    public void testNoFiltering() throws Exception {
+    @Test
+    public void noFiltering() throws Exception {
         final String INPUT = "Whatever";
         StringReader reader = new StringReader(INPUT);
         CharSequence result = factory.filter(reader);
@@ -53,7 +54,8 @@ public class FilteringSequenceFactoryTes
         assertEquals("No filtering so input equals output. Independent of previous input", INPUT, output);
     }
 
-    public void testFiltering() throws Exception {
+    @Test
+    public void filtering() throws Exception {
         final String INPUT = "Whatever";
         StringReader reader = new StringReader(INPUT);
         CharSequence result = factory.filter(reader);
@@ -67,7 +69,8 @@ public class FilteringSequenceFactoryTes
         assertEquals("All filtered output is empty. Independent of previous input", 0, result.length());
     }
     
-    public void testOverCapacity() throws Exception {
+    @Test
+    public void overCapacity() throws Exception {
         final String INPUT = "WhateverWhateverWhateverWhateverWhateverWhateverWhateverWhateverWhateverWhatever";
         StringReader reader = new StringReader(INPUT);
         CharSequence result = factory.filter(reader);

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/HeaderMatcherTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/HeaderMatcherTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/HeaderMatcherTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/HeaderMatcherTest.java Sun May 13 17:22:20 2012
@@ -18,29 +18,31 @@
  */ 
 package org.apache.rat.header;
 
+import org.junit.Before;
+import org.junit.Test;
+
 import java.io.StringReader;
 import java.util.regex.Pattern;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
-public class HeaderMatcherTest extends TestCase {
+public class HeaderMatcherTest {
 
     int capacity;
     HeaderMatcher matcher;
     SimpleCharFilter filter;
-    
-    protected void setUp() throws Exception {
-        super.setUp();
+
+    @Before
+    public void setUp() throws Exception {
         capacity = 20;
         filter = new SimpleCharFilter();
         matcher = new HeaderMatcher(filter, 20);
     }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-    
-    public void testSimpleMatches() throws Exception {
+    @Test
+    public void simpleMatches() throws Exception {
         Pattern hatPattern = Pattern.compile("(.*)hat(.*)");
         Pattern headPattern = Pattern.compile("head....");
         StringReader reader = new StringReader("The mad hatter");
@@ -52,8 +54,9 @@ public class HeaderMatcherTest extends T
         assertFalse(matcher.matches(hatPattern));
         assertTrue(matcher.matches(headPattern));   
     }
-    
-    public void testFilteredMatches() throws Exception {
+
+    @Test
+    public void filteredMatches() throws Exception {
         Pattern capPattern = Pattern.compile("cap(.*)");
         StringReader reader = new StringReader("capped");
         matcher.read(reader);
@@ -64,13 +67,15 @@ public class HeaderMatcherTest extends T
         assertFalse(matcher.matches(capPattern));
     }
 
-    public void testNoLines() throws Exception {
+    @Test
+    public void noLines() throws Exception {
         StringReader reader = new StringReader("None");
         matcher.read(reader);
         assertEquals("No lines read", 0, matcher.lines());
     }
     
-    public void testLines() throws Exception {
+    @Test
+    public void lines() throws Exception {
         StringReader reader = new StringReader("One\n");
         matcher.read(reader);
         assertEquals("One line read", 1, matcher.lines());
@@ -85,7 +90,8 @@ public class HeaderMatcherTest extends T
         assertEquals("Three lines read", 3, matcher.lines());
     }
     
-    public void testTooManyLines() throws Exception {
+    @Test
+    public void tooManyLines() throws Exception {
         StringReader reader = new StringReader("WhateverWhateverWhateverWhateverWhateverWhateverWhateverWhatever");
         matcher.read(reader);
         assertEquals("Too many lines read", -1, matcher.lines());

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/HeaderMatcherWithBeansTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/HeaderMatcherWithBeansTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/HeaderMatcherWithBeansTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/HeaderMatcherWithBeansTest.java Sun May 13 17:22:20 2012
@@ -19,20 +19,24 @@
  */ 
 package org.apache.rat.header;
 
+import org.junit.Before;
+import org.junit.Test;
+
 import java.io.StringReader;
 import java.util.regex.Pattern;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
-public class HeaderMatcherWithBeansTest extends TestCase {
+public class HeaderMatcherWithBeansTest {
 
     int capacity;
     HeaderMatcher matcher;
     SimpleCharFilter filter;
     HeaderBean[] beans;
-    
-    protected void setUp() throws Exception {
-        super.setUp();
+
+    @Before
+    public void setUp() throws Exception {
         HeaderBean[] beans = {
                 new HeaderBean(),
                 new HeaderBean(),
@@ -44,11 +48,8 @@ public class HeaderMatcherWithBeansTest 
         matcher = new HeaderMatcher(filter, 20, beans);
     }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-    
-    public void testNulls() throws Exception {
+    @Test
+    public void nulls() throws Exception {
         beans[0].setMatch(false);
         beans[1].setMatch(true);
         beans[2].setMatch(false);
@@ -64,8 +65,9 @@ public class HeaderMatcherWithBeansTest 
         assertFalse("State preserved", beans[1].isMatch());
         assertTrue("State preserved", beans[2].isMatch());
     }
-    
-    public void testMatches() throws Exception {
+
+    @Test
+    public void matches() throws Exception {
         beans[0].setHeaderPattern(Pattern.compile("What(.*)"));
         beans[1].setHeaderPattern(Pattern.compile("(.*)ever"));
         beans[2].setHeaderPattern(Pattern.compile("What"));

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/SimpleCharFilter.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/SimpleCharFilter.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/SimpleCharFilter.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/header/SimpleCharFilter.java Sun May 13 17:22:20 2012
@@ -23,10 +23,7 @@ public class SimpleCharFilter implements
     public boolean filterOut = false;
     
     public SimpleCharFilter() {}
-    public SimpleCharFilter(boolean filterOut) {
-        this.filterOut = filterOut;
-    }
-    
+
     public boolean isFilteredOut(char character) {
         return filterOut;
     }

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java Sun May 13 17:22:20 2012
@@ -18,31 +18,30 @@
  */ 
 package org.apache.rat.policy;
 
-import junit.framework.TestCase;
-
 import org.apache.rat.api.Document;
 import org.apache.rat.api.MetaData;
 import org.apache.rat.document.MockLocation;
 import org.apache.rat.report.claim.impl.xml.MockClaimReporter;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
 
 
-public class DefaultPolicyTest extends TestCase {
+public class DefaultPolicyTest {
 
     MockClaimReporter reporter;
     DefaultPolicy policy;
     private Document subject;
-    
-    protected void setUp() throws Exception {
-        super.setUp();
+
+    @Before
+    public void setUp() throws Exception {
         reporter = new MockClaimReporter();
         policy = new DefaultPolicy();
         subject = new MockLocation("subject");
     }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
+    @Test
     public void testASLFamily() throws Exception {
         subject.getMetaData().set(MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_APACHE_LICENSE_VERSION_2_0);
         policy.analyse(subject);
@@ -53,24 +52,28 @@ public class DefaultPolicyTest extends T
         assertEquals(pApproved, MetaData.RAT_APPROVED_LICENSE_VALUE_TRUE.equals(subject.getMetaData().value(MetaData.RAT_URL_APPROVED_LICENSE)));
     }
 
+    @Test
     public void testOASISFamily() throws Exception {
         subject.getMetaData().set(MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_OASIS_OPEN_LICENSE);
         policy.analyse(subject);
         assertApproval(true);
     }
     
+    @Test
     public void testW3CFamily() throws Exception {
         subject.getMetaData().set(MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_W3C_SOFTWARE_COPYRIGHT);
         policy.analyse(subject);
         assertApproval(true);
     }
     
+    @Test
     public void testW3CDocFamily() throws Exception {
         subject.getMetaData().set(MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_W3C_DOCUMENT_COPYRIGHT);
         policy.analyse(subject);
         assertApproval(true);
     }
     
+    @Test
     public void testUnknownFamily() throws Exception {
         subject.getMetaData().set(MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_UNKNOWN);
         policy.analyse(subject);

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java Sun May 13 17:22:20 2012
@@ -18,12 +18,6 @@
  */ 
 package org.apache.rat.report.xml;
 
-import java.io.File;
-import java.io.StringWriter;
-import java.util.regex.Pattern;
-
-import junit.framework.TestCase;
-
 import org.apache.rat.ReportConfiguration;
 import org.apache.rat.analysis.MockLicenseMatcher;
 import org.apache.rat.api.MetaData;
@@ -33,31 +27,36 @@ import org.apache.rat.report.xml.writer.
 import org.apache.rat.report.xml.writer.impl.base.XmlWriter;
 import org.apache.rat.test.utils.Resources;
 import org.apache.rat.walker.DirectoryWalker;
+import org.junit.Before;
+import org.junit.Test;
 
-public class XmlReportFactoryTest extends TestCase {
+import java.io.File;
+import java.io.StringWriter;
+import java.util.regex.Pattern;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class XmlReportFactoryTest {
 
     private static final Pattern IGNORE_EMPTY = Pattern.compile(".svn|Empty.txt");
     
     StringWriter out;
     IXmlWriter writer;
     
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         out = new StringWriter();
         writer = new XmlWriter(out);
         writer.startDocument();
     }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-    
-
     private void report(DirectoryWalker directory, RatReport report) throws Exception {
         directory.run(report);
     }
     
-    public void testStandardReport() throws Exception {
+    @Test
+    public void standardReport() throws Exception {
     	final String elementsPath = Resources.getResourceDirectory("elements/Source.java");
         final MockLicenseMatcher mockLicenseMatcher = new MockLicenseMatcher();
         DirectoryWalker directory = new DirectoryWalker(new File(elementsPath), IGNORE_EMPTY);
@@ -90,9 +89,9 @@ public class XmlReportFactoryTest extend
                 "<resource name='" + elementsPath + "/dummy.jar'><type name='archive'/></resource>" +
                                    "</rat-report>"));
         assertTrue("Is well formed", XmlUtils.isWellFormedXml(output));
-        assertEquals("Binary files", new Integer(1), statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_BINARY));
-        assertEquals("Notice files", new Integer(2), statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_NOTICE));
-        assertEquals("Standard files", new Integer(5), statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_STANDARD));
-        assertEquals("Archives", new Integer(1), statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_ARCHIVE));
+        assertEquals("Binary files", Integer.valueOf(1), statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_BINARY));
+        assertEquals("Notice files", Integer.valueOf(2), statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_NOTICE));
+        assertEquals("Standard files", Integer.valueOf(5), statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_STANDARD));
+        assertEquals("Archives", Integer.valueOf(1), statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_ARCHIVE));
     }
 }

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java Sun May 13 17:22:20 2012
@@ -18,36 +18,39 @@
  */ 
 package org.apache.rat.report.xml;
 
-import java.io.File;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Pattern;
-
-import junit.framework.TestCase;
-
-import org.apache.rat.walker.DirectoryWalker;
 import org.apache.rat.analysis.DefaultAnalyserFactory;
 import org.apache.rat.analysis.IHeaderMatcher;
 import org.apache.rat.analysis.RatHeaderAnalysisException;
 import org.apache.rat.api.Document;
 import org.apache.rat.document.IDocumentAnalyser;
+import org.apache.rat.report.AbstractReport;
 import org.apache.rat.report.RatReport;
 import org.apache.rat.report.claim.impl.xml.SimpleXmlClaimReporter;
 import org.apache.rat.report.claim.util.ClaimReporterMultiplexer;
 import org.apache.rat.report.xml.writer.IXmlWriter;
 import org.apache.rat.report.xml.writer.impl.base.XmlWriter;
 import org.apache.rat.test.utils.Resources;
+import org.apache.rat.walker.DirectoryWalker;
+import org.junit.Before;
+import org.junit.Test;
 
-public class XmlReportTest extends TestCase {
+import java.io.File;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import static org.junit.Assert.assertTrue;
+
+public class XmlReportTest {
 
     private static final Pattern IGNORE = Pattern.compile(".svn");
     StringWriter out;
     IXmlWriter writer;
     RatReport report;
     
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         out = new StringWriter();
         writer = new XmlWriter(out);
         writer.startDocument();
@@ -62,20 +65,17 @@ public class XmlReportTest extends TestC
             }            
         };
         IDocumentAnalyser analyser = DefaultAnalyserFactory.createDefaultAnalyser(matcher);
-        final List reporters = new ArrayList();
+        final List<AbstractReport> reporters = new ArrayList<AbstractReport>();
         reporters.add(reporter);
         report = new ClaimReporterMultiplexer(analyser, reporters); 
     }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
     private void report(DirectoryWalker directory) throws Exception {
         directory.run(report);
     }
     
-    public void testBaseReport() throws Exception {
+    @Test
+    public void baseReport() throws Exception {
     	final String elementsPath = Resources.getResourceDirectory("elements/Source.java");
         DirectoryWalker directory = new DirectoryWalker(new File(elementsPath), IGNORE);
         report.startReport();

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlUtils.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlUtils.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlUtils.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlUtils.java Sun May 13 17:22:20 2012
@@ -18,23 +18,28 @@
  */ 
 package org.apache.rat.report.xml;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.lang.reflect.UndeclaredThrowableException;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
-
-import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.lang.reflect.UndeclaredThrowableException;
 
 public final class XmlUtils {
+    /**
+     * Private constructor, to prevent accidental instantiation.
+     */
+    private XmlUtils() {
+        // Does nothing
+    }
 
     public static final boolean isWellFormedXml(final String string) throws Exception {
         return isWellFormedXml(new InputSource(new StringReader(string)));

Modified: creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/writer/XmlWriterUtilsTest.java
URL: http://svn.apache.org/viewvc/creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/writer/XmlWriterUtilsTest.java?rev=1337943&r1=1337942&r2=1337943&view=diff
==============================================================================
--- creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/writer/XmlWriterUtilsTest.java (original)
+++ creadur/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/writer/XmlWriterUtilsTest.java Sun May 13 17:22:20 2012
@@ -18,33 +18,34 @@
  */ 
 package org.apache.rat.report.xml.writer;
 
+import org.apache.rat.report.xml.writer.impl.base.XmlWriter;
+import org.junit.Before;
+import org.junit.Test;
+
 import java.io.StringWriter;
 
-import junit.framework.TestCase;
-import org.apache.rat.report.xml.writer.impl.base.XmlWriter;
+import static org.junit.Assert.assertEquals;
 
-public class XmlWriterUtilsTest extends TestCase {
+public class XmlWriterUtilsTest {
 
     StringWriter out;
     IXmlWriter writer;
-    
-    protected void setUp() throws Exception {
-        super.setUp();
+
+    @Before
+    public void setUp() throws Exception {
         out = new StringWriter();
         writer = new XmlWriter(out);
         writer.openElement("alpha");
     }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    public void testWriteTrue() throws Exception {
+    @Test
+    public void writeTrue() throws Exception {
         XmlWriterUtils.writeAttribute(writer, "name", true);
         assertEquals("Attribute written as True", "<alpha name='true'", out.toString());
     }
 
-    public void testWriteFalse() throws Exception {
+    @Test
+    public void writeFalse() throws Exception {
         XmlWriterUtils.writeAttribute(writer, "name", false);
         assertEquals("Attribute written as False", "<alpha name='false'", out.toString());
     }



Mime
View raw message