Improve integration testing framework
git-svn-id: https://svn.apache.org/repos/asf/creadur/whisker/trunk@1407953 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/apache-whisker-plugin4maven/pom.xml b/apache-whisker-plugin4maven/pom.xml
index 55d525b..f49631d 100644
--- a/apache-whisker-plugin4maven/pom.xml
+++ b/apache-whisker-plugin4maven/pom.xml
@@ -87,6 +87,12 @@
<artifactId>apache-whisker-velocity</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
+
</dependencies>
diff --git a/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/AnyLineContainsCheck.java b/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/AnyLineContainsCheck.java
index 9380719..549de66 100644
--- a/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/AnyLineContainsCheck.java
+++ b/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/AnyLineContainsCheck.java
@@ -20,7 +20,7 @@
import static org.apache.creadur.whisker.it.Not.*;
-public class AnyLineContainsCheck {
+public class AnyLineContainsCheck implements Check {
final String value;
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 75611b0..26e7981 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
@@ -24,27 +24,27 @@
public class Helpers {
- public static AnyLineContainsCheck aLineContainsResource(String name) {
+ public static Check aLineContainsResource(String name) {
return new AnyLineContainsCheck(name);
}
- public static AnyLineContainsCheck aLineContainsCopyrightNotice(String copyrightNotice) {
+ public static Check aLineContainsCopyrightNotice(String copyrightNotice) {
return new AnyLineContainsCheck(copyrightNotice);
}
- public static AnyLineContainsCheck aLineContainsAL2() {
+ public static Check aLineContainsAL2() {
return new AnyLineContainsCheck("Version 2.0, January 2004");
}
- public static AnyLineContainsCheck aLineContainsMIT() {
+ public static Check aLineContainsMIT() {
return new AnyLineContainsCheck("Permission is hereby granted, free of charge, to any person");
}
- public static AnyLineContainsCheck aLineContainsCDDL1() {
+ public static Check aLineContainsCDDL1() {
return new AnyLineContainsCheck("COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0");
}
- public static AnyLineContainsCheck aLineContains(String value) {
+ public static Check aLineContains(String value) {
return new AnyLineContainsCheck(value);
}
diff --git a/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/LicenseVerifier.java b/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/LicenseVerifier.java
index 5102079..ceed250 100644
--- a/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/LicenseVerifier.java
+++ b/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/LicenseVerifier.java
@@ -18,6 +18,8 @@
*/
package org.apache.creadur.whisker.it;
+import static org.apache.creadur.whisker.it.CheckHelpers.*;
+
import java.io.*;
import java.util.ArrayList;
import java.util.List;
@@ -25,12 +27,12 @@
public class LicenseVerifier {
final File licenseFile;
- final List<AnyLineContainsCheck> checks;
+ final List<Check> checks;
public LicenseVerifier(final File licenseFile) {
this.licenseFile = licenseFile;
- this.checks = new ArrayList<AnyLineContainsCheck>();
+ this.checks = new ArrayList<Check>();
}
public LicenseVerifier expectThat(final AnyLineContainsCheck check) {
@@ -50,17 +52,12 @@
reader.close();
}
- Results result = new Results().titled("FAILURES in LICENSE:");
- for (AnyLineContainsCheck check:checks) {
- check.report(result);
- }
- return result.report();
+ final Results results = new Results().titled("FAILURES in LICENSE:");
+ return to(results).report(checks).collate();
}
private String checkLine(final String line) {
- for (AnyLineContainsCheck check:checks) {
- check.check(line);
- }
+ doCheck(line).with(checks);
return line;
}
}
diff --git a/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/Results.java b/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/Results.java
index 881565e..b17feca 100644
--- a/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/Results.java
+++ b/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/Results.java
@@ -35,7 +35,7 @@
return this;
}
- public String report() {
+ public String collate() {
final String result;
if (failed) {
endLine();
diff --git a/pom.xml b/pom.xml
index 06141f3..1a1812a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -57,7 +57,7 @@
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
-
+
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
@@ -71,6 +71,12 @@
</dependency>
<dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+ </dependency>
+
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
@@ -82,6 +88,7 @@
<version>2.5.1</version>
<scope>test</scope>
</dependency>
+
</dependencies>
</dependencyManagement>
@@ -100,14 +107,14 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<target.jdk>1.5</target.jdk>
<junit.version>3.8.1</junit.version>
-<!--
+<!--
Custom distributions
====================
override these values. You might do this by adding a profile to your local settings.xml.
-->
<whisker.site.url>file:stage</whisker.site.url>
<whisker.site.name>Whisker Website</whisker.site.name>
- <whisker.site.id>org.apache.creadur.whisker.site</whisker.site.id>
+ <whisker.site.id>org.apache.creadur.whisker.site</whisker.site.id>
</properties>
<!-- ================================ Build information -->
@@ -226,7 +233,7 @@
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.4</version>
</plugin>
-
+
</reportPlugins>
</configuration>
</plugin>
@@ -248,14 +255,14 @@
<plugins>
</plugins>
</build>
-
+
<!-- ================================ Project information -->
-
+
<name>Apache Whisker</name>
<description>Apache Whisker wrangles legal documentation for composed applications.</description>
<url>http://creadur.apache.org/whisker/</url>
<inceptionYear>2011</inceptionYear>
-
+
<licenses>
<license>
<name>Apache License, Version 2</name>
@@ -301,14 +308,14 @@
<name>${whisker.site.name}</name>
<url>${whisker.site.url}</url>
</site>
- </distributionManagement>
-
+ </distributionManagement>
+
<scm>
<url>http://svn.apache.org/repos/asf/creadur/whisker/trunk</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/creadur/whisker/trunk</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/creadur/whisker/trunk</developerConnection>
</scm>
-
+
<ciManagement>
<system>Buildbot</system>
<url>http://ci.apache.org/builders/whisker-trunk</url>