added method to validate certain text in a log
git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@641999 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/maven/it/Verifier.java b/src/main/java/org/apache/maven/it/Verifier.java
index daab205..c3149c1 100644
--- a/src/main/java/org/apache/maven/it/Verifier.java
+++ b/src/main/java/org/apache/maven/it/Verifier.java
@@ -229,6 +229,33 @@
}
}
+ /**
+ * Throws an exception if the text is not present in the log.
+ * @param text
+ * @throws VerificationException
+ */
+ public void verifyTextInLog( String text )
+ throws VerificationException
+ {
+ List lines;
+ lines = loadFile( getBasedir(), LOG_FILENAME, false );
+
+ boolean result = false;
+ for ( Iterator i = lines.iterator(); i.hasNext(); )
+ {
+ String line = (String) i.next();
+ if ( line.indexOf( text ) >= 0)
+ {
+ result = true;
+ break;
+ }
+ }
+ if (!result)
+ {
+ throw new VerificationException( "Text not found in log: " + text );
+ }
+}
+
public Properties loadProperties( String filename )
throws VerificationException
{