Code: Select all
[Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath]: org.junit.platform.commons.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath
< /code>
Der Code, den ich zum Testen verwende, ist < /p>
@RestController
@RequestMapping("/Paolo")
public class HelloController {
Logger logger = LoggerFactory.getLogger(HelloController.class);
@GetMapping("/hello")
String hello() throws ClassNotFoundException {
Class.forName("org.junit.jupiter.engine.JupiterTestEngine"); // no exception thrown
Iterable testEngines = ServiceLoader.load(TestEngine.class,
ClassLoaderUtils.getDefaultClassLoader()); // method used by junit to found the TestEngineImplementation JupiterTestEngine is the only real implementation
logger.info("testEngines: {}", testEngines.iterator().hasNext()); // false
return "Hi";
}
}