Я получаю сообщение об ошибке, пытаясь следовать цитрусовому примеру в главе "5.3. Конструктор тестов Java DSL" (https://citrusframework.org/citrus/reference/2.7.8/html/index.html#java-dsl-test-designer),, вот код в LoggingTestDesignerRightOrder.java
package com.consol.citrus.samples;
import org.testng.annotations.Test;
import com.consol.citrus.annotations.CitrusTest;
import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;
import com.consol.citrus.TestAction;
import com.consol.citrus.context.TestContext;
import com.consol.citrus.actions.AbstractTestAction;
import com.consol.citrus.samples.LoggingService;
@Test
public class LoggingTestDesignerRightOrder extends TestNGCitrusTestDesigner {
private LoggingService loggingService = new LoggingService();
@CitrusTest(name = "LoggingTestRightOrder")
public void loggingTest() {
echo("Before loggingService call");
action(new AbstractTestAction() {
doExecute(TestContext context) {
loggingService.log("Now called custom logging service");
}
});
echo("After loggingService call");
}
}
При запускеmvn clean verify -Dit.test = LoggingTestDesignerRightOrder
Я получил следующую ошибку:
Не удалось выполнить цель org.apache.maven.plugins: maven-compiler-plugin: 3.6.1: testCompile(default-testCompile) для проекта citrus-sample: ошибка компиляции [ERROR] /Users/fb/dev/citrus/citrus-sample/src/test/java/com/consol/citrus/samples/LoggingTestDesignerRightOrder.java:[20,13] недопустимое объявление метода; требуется возвращаемый тип
Я вижу, что это вызов doExecute, который создает pb, но не может найти то, что необходимо для его компиляции.
Полный вывод mvnКоманда:
Scanning for projects...
[INFO]
[INFO] --------------< com.consol.citrus.samples:citrus-sample >---------------
[INFO] Building Citrus Integration Test 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ citrus-sample ---
[INFO] Deleting /Users/fb/dev/citrus/citrus-sample/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ citrus-sample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ citrus-sample ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ citrus-sample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) @ citrus-sample ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to /Users/fb/dev/citrus/citrus-sample/target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/fb/dev/citrus/citrus-sample/src/test/java/com/consol/citrus/samples/LoggingTestDesignerRightOrder.java:[20,13] invalid method declaration; return type required
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.150 s
[INFO] Finished at: 2018-12-22T21:54:19+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:testCompile (default-testCompile) on project citrus-sample: Compilation failure
[ERROR] /Users/fb/dev/citrus/citrus- sample/src/test/java/com/consol/citrus/samples/LoggingTestDesignerRightOrder.java:[20,13] invalid method declaration; return type required
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Спасибо за помощь.