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 <khmarba...@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() ); + } + } }