Improved test framework and added some checks for notice
git-svn-id: https://svn.apache.org/repos/asf/creadur/whisker/trunk@1407998 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/apache-whisker-plugin4maven/src/it/example-copyright-notices/descriptor.xml b/apache-whisker-plugin4maven/src/it/example-copyright-notices/descriptor.xml
index e617f0e..4461351 100644
--- a/apache-whisker-plugin4maven/src/it/example-copyright-notices/descriptor.xml
+++ b/apache-whisker-plugin4maven/src/it/example-copyright-notices/descriptor.xml
@@ -792,8 +792,10 @@
<!-- Consulting the release of the Apache licensed work, we discover
(and add) the NOTICE -->
<notice id='example.org'>
- Copyright (c) 2525 The Example Project
- http://example.org
+ Copyright (c) 9595 The Example Project
+
+ This product includes software developed at
+ The Example Foundation (http://example.org/).
</notice>
</notices>
<!-- To keep this example simple, assume all works are licensed by the
diff --git a/apache-whisker-plugin4maven/src/it/example-copyright-notices/verify.groovy b/apache-whisker-plugin4maven/src/it/example-copyright-notices/verify.groovy
index 88bf239..6098a08 100644
--- a/apache-whisker-plugin4maven/src/it/example-copyright-notices/verify.groovy
+++ b/apache-whisker-plugin4maven/src/it/example-copyright-notices/verify.groovy
@@ -38,5 +38,9 @@
license.expectThat(aLineContainsResource("mit.txt"))
license.expectThat(aLineContainsAL2())
//license.expectThat(aLineContainsResource("apache.txt"))
- return license.failures()
+ notice = noticeIn(basedir)
+ notice.expectThat(aLineContains("Copyright (c) 9595 The Example Project"))
+ notice.expectThat(aLineContains("This product includes software developed at"))
+ notice.expectThat(aLineContains("The Example Foundation (http://example.org/)."))
+ return aggregate(license.failures(), notice.failures())
}
\ No newline at end of file
diff --git a/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/Helpers.java b/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/Helpers.java
index 19e44e0..4e05f32 100644
--- a/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/Helpers.java
+++ b/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/Helpers.java
@@ -25,6 +25,29 @@
public class Helpers {
+ private static final String PATH_TO_LICENSE_FILE = "target/LICENSE";
+
+ private static final String PATH_TO_NOTICE_FILE = "target/NOTICE";
+
+ public static String aggregate(final String firstFailureReport,
+ final String secondFailureReport) {
+ final String result;
+ if (firstFailureReport == null) {
+ if (secondFailureReport == null) {
+ result = null;
+ } else {
+ result = secondFailureReport;
+ }
+ } else {
+ if (secondFailureReport == null) {
+ result = firstFailureReport;
+ } else {
+ result = firstFailureReport + "\n\n" + secondFailureReport;
+ }
+ }
+ return result;
+ }
+
public static Check aLineContainsResource(String name) {
return new AnyLineContainsCheck(name);
}
@@ -53,10 +76,8 @@
return new AnyLineContainsCheck(value);
}
- private static final String PATH_TO_LICENSE_FILE = "target/LICENSE";
-
public static boolean noticeIsMissing(File basedir) {
- return fileIsMissing(basedir, "target/NOTICE");
+ return fileIsMissing(basedir, PATH_TO_NOTICE_FILE);
}
private static boolean fileIsMissing(File basedir, final String string) {
@@ -71,6 +92,10 @@
return new FileVerifier(new File(basedir, PATH_TO_LICENSE_FILE), "LICENSE");
}
+ public static FileVerifier noticeIn(File basedir) {
+ return new FileVerifier(new File(basedir, PATH_TO_NOTICE_FILE), "NOTICE");
+ }
+
public static Results results() {
return new Results();
}