creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1361737 - in /creadur/whisker/trunk/apache-whisker-velocity/src: main/resources/org/apache/creadur/whisker/template/velocity/license.vm test/java/org/apache/creadur/whisker/out/velocity/TestLicenseGeneration.java
Date Sun, 15 Jul 2012 17:28:12 GMT
Author: rdonkin
Date: Sun Jul 15 17:28:12 2012
New Revision: 1361737

URL: http://svn.apache.org/viewvc?rev=1361737&view=rev
Log:
Don't print message about third party resource when none are contained.

Modified:
    creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm
    creadur/whisker/trunk/apache-whisker-velocity/src/test/java/org/apache/creadur/whisker/out/velocity/TestLicenseGeneration.java

Modified: creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm?rev=1361737&r1=1361736&r2=1361737&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm
(original)
+++ creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm
Sun Jul 15 17:28:12 2012
@@ -20,7 +20,9 @@
 #################################################################################
 $work.PrimaryLicense.Text
 
+#if ( ! $work.isPrimaryOnly() )
 This distribution contains third party resources.
+#end
 #foreach( $directory in $work.Contents )
 #if (! $work.isOnlyPrimary( $directory ) )
 Within the $directory.Name directory

Modified: creadur/whisker/trunk/apache-whisker-velocity/src/test/java/org/apache/creadur/whisker/out/velocity/TestLicenseGeneration.java
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-velocity/src/test/java/org/apache/creadur/whisker/out/velocity/TestLicenseGeneration.java?rev=1361737&r1=1361736&r2=1361737&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-velocity/src/test/java/org/apache/creadur/whisker/out/velocity/TestLicenseGeneration.java
(original)
+++ creadur/whisker/trunk/apache-whisker-velocity/src/test/java/org/apache/creadur/whisker/out/velocity/TestLicenseGeneration.java
Sun Jul 15 17:28:12 2012
@@ -32,11 +32,12 @@ import org.apache.creadur.whisker.model.
 
 import junit.framework.TestCase;
 
-public class TestNoticeGeneration extends TestCase {
+public class TestLicenseGeneration extends TestCase {
     
     StringResultWriterFactory writerFactory;
     VelocityEngine subject;
-    License primaryLicense = new License(false, "This is the license text", Collections.<String>
emptyList(), "example.org", "http://example.org", "Example License");
+    String primaryLicenseText = "This is the primary license text";
+    License primaryLicense = new License(false, primaryLicenseText, Collections.<String>
emptyList(), "example.org", "http://example.org", "Example License");
     String primaryOrg = "example.org";
     String primaryNotice = "The primary notice.";
     Collection<WithinDirectory> contents = new ArrayList<WithinDirectory>();
@@ -57,25 +58,17 @@ public class TestNoticeGeneration extend
         super.tearDown();
     }
     
-    public void testThatWhenThereAreNoThirdPartyNoticesHeaderIsNotShown() throws Exception
{
+    public void testThatWhenThereAreNoThirdPartyNoticesFooterIsNotShown() throws Exception
{
         Descriptor work = 
                 new Descriptor(primaryLicense, primaryOrg,  primaryNotice, 
                         licenses, notices, organisations, contents);
         
         subject.generate(work, writerFactory);
-        
-        assertEquals("Only one request for NOTICE writer", 1, writerFactory.requestsFor(Result.NOTICE));
-        assertEquals("When no third party notices, expect that only the primary notice is
output", primaryNotice, writerFactory.firstOutputFor(Result.NOTICE).trim());
-    }
-    
-    public void testThatNoticeOutputIsSkippedWhenThereAreNoNotices() throws Exception {
-        Descriptor work = 
-                new Descriptor(primaryLicense, primaryOrg,  "", 
-                        licenses, notices, organisations, contents);
-        
-        subject.generate(work, writerFactory);
-        
-        assertEquals("No requests for NOTICE writer", 0, writerFactory.requestsFor(Result.NOTICE));
-    }
 
+        assertTrue("Check that work is suitable for this test", work.isPrimaryOnly());
+        assertEquals("Only one request for LICENSE writer", 1, writerFactory.requestsFor(Result.LICENSE));
+        assertEquals("When no third party notices, expect that only the license text is output",

+                primaryLicenseText, 
+                writerFactory.firstOutputFor(Result.LICENSE).trim());
+    }
 }



Mime
View raw message