slawekjaranowski commented on code in PR #132:
URL: https://github.com/apache/maven-help-plugin/pull/132#discussion_r2485726763


##########
src/test/java/org/apache/maven/plugins/help/EvaluateMojoTest.java:
##########
@@ -114,6 +114,29 @@ void testEvaluateWithoutExpressionWithOutput(EvaluateMojo 
mojo) throws Exception
         verify(inputHandler, times(2)).readLine();
     }
 
+    /**
+     * Tests evaluation of a complex expression.
+     * @throws Exception in case of errors.
+     */
+    public void testEvaluateForComplexExpression() throws Exception {
+        File testPom = new File(getBasedir(), 
"target/test-classes/unit/evaluate/plugin-config-complex.xml");
+
+        EvaluateMojo mojo = (EvaluateMojo) lookupMojo("evaluate", testPom);
+
+        ExpressionEvaluator expressionEvaluator = 
mock(PluginParameterExpressionEvaluator.class);

Review Comment:
   Mock is already created



##########
src/test/java/org/apache/maven/plugins/help/EvaluateMojoTest.java:
##########
@@ -114,6 +114,29 @@ void testEvaluateWithoutExpressionWithOutput(EvaluateMojo 
mojo) throws Exception
         verify(inputHandler, times(2)).readLine();
     }
 
+    /**
+     * Tests evaluation of a complex expression.
+     * @throws Exception in case of errors.
+     */
+    public void testEvaluateForComplexExpression() throws Exception {
+        File testPom = new File(getBasedir(), 
"target/test-classes/unit/evaluate/plugin-config-complex.xml");
+
+        EvaluateMojo mojo = (EvaluateMojo) lookupMojo("evaluate", testPom);
+
+        ExpressionEvaluator expressionEvaluator = 
mock(PluginParameterExpressionEvaluator.class);
+        
when(expressionEvaluator.evaluate("project_version=${project.version}"))
+                .thenReturn("project_version=1.0.0-SNAPSHOT");
+
+        setUpMojo(mojo, null, expressionEvaluator);

Review Comment:
   replace by 
   ```
           setVariableValueToObject(mojo, "evaluator", expressionEvaluator);
   
   ```



##########
src/test/java/org/apache/maven/plugins/help/EvaluateMojoTest.java:
##########
@@ -114,6 +114,29 @@ void testEvaluateWithoutExpressionWithOutput(EvaluateMojo 
mojo) throws Exception
         verify(inputHandler, times(2)).readLine();
     }
 
+    /**
+     * Tests evaluation of a complex expression.
+     * @throws Exception in case of errors.
+     */
+    public void testEvaluateForComplexExpression() throws Exception {
+        File testPom = new File(getBasedir(), 
"target/test-classes/unit/evaluate/plugin-config-complex.xml");

Review Comment:
   We not need a separate config file, we can use `@MojoParameter`



##########
src/test/java/org/apache/maven/plugins/help/EvaluateMojoTest.java:
##########
@@ -114,6 +114,29 @@ void testEvaluateWithoutExpressionWithOutput(EvaluateMojo 
mojo) throws Exception
         verify(inputHandler, times(2)).readLine();
     }
 
+    /**
+     * Tests evaluation of a complex expression.
+     * @throws Exception in case of errors.
+     */
+    public void testEvaluateForComplexExpression() throws Exception {

Review Comment:
   Tests was rewritten to JUnit 5 annotations
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to