You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2018/08/25 21:38:01 UTC

[maven-enforcer] branch MENFORCER-312 updated: Added another test.

This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch MENFORCER-312
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git


The following commit(s) were added to refs/heads/MENFORCER-312 by this push:
     new 6e6c354  Added another test.
6e6c354 is described below

commit 6e6c354cc9c5a8a45a957413d055e970cd6b195c
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sat Aug 25 23:37:49 2018 +0200

    Added another test.
---
 .../enforcer/TestRequireEnvironmentVariable.java   | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireEnvironmentVariable.java b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireEnvironmentVariable.java
index 862e8b8..71a069f 100755
--- a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireEnvironmentVariable.java
+++ b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireEnvironmentVariable.java
@@ -123,4 +123,29 @@ public class TestRequireEnvironmentVariable
             fail( "This should not throw an exception " + e.getMessage() );
         }
     }
+
+    /**
+     * Test rule with regex.
+     *
+     * @throws EnforcerRuleException the enforcer rule exception
+     */
+    public void testRuleWithRegexDifferent()
+        throws EnforcerRuleException
+    {
+        EnforcerRuleHelper helper = EnforcerTestUtils.getHelper();
+
+        RequireEnvironmentVariable rule = new RequireEnvironmentVariable();
+        rule.setVariableName( "PATH" );
+
+        // can't really predict what a PATH will looks like, just enforce it ain't empty
+        rule.setRegex( ".+" );
+        try
+        {
+            rule.execute( helper );
+        }
+        catch ( EnforcerRuleException e )
+        {
+            fail( "This should not throw an exception " + e.getMessage() );
+        }
+    }
 }