authorjapps / authorjapps/zerocode
JUnit5 compatibility with other extensions
- Dominant language
- Java
- Stars
- 1k
- Forks
- 453
- Avg merge
- 7d 2h
- Merged PRs (30d)
- 5
Description
I'm running a server based on the [Vert.x](vertx.io) framework. To support testing of asynchronous code, they provide a JUnit5 extension which injects an instance of Vertx and a VertxTestContext. In order for a test to complete, one has to call `complete()` or `fail(Throwable)` on the test context or use one of the helper methods that invoke them.
```kotlin
@Test
fun testSomeRequest(vertx: Vertx, testContext: VertxTestContext) {
invokeSomeCodeThatReturnsFuture().onComplete(testContext.completing())
}
```
When trying to compose a test like this with into Zerocode test using a `TestMapping` annotation, it will fail to identify this as a test method because it only looks for argument-less test methods (i.e. `methodParameterTypes = ''`).
```
Caused by: org.junit.platform.commons.JUnitException: MethodSelector [className = 'my.TestClass', methodName = 'testSomeRequest', methodParameterTypes = ''] resolution failed
at org.junit.platform.launcher.listeners.discovery.AbortOnFailureLauncherDiscoveryListener.selectorProcessed(AbortOnFailureLauncherDiscoveryListener.java:39)
at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:102)
at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:82)
at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:113)
at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.resolveSelectors(DiscoverySelectorResolver.java:45)
at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:69)
at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:181)
```
Is there a way to do this?
Contributor guide
Assessment
This issue has not been assessed yet.