Future support for Vertx.x JUnit tests.
https://jitpack.io/#gofabian/vertx-unit-future
To use it in your Maven build add:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
and the dependency:
<dependency>
<groupId>com.github.gofabian</groupId>
<artifactId>vertx-unit-future</artifactId>
<version>x.x.x</version>
</dependency>
The FutureVertxRunner adds Future support to the VertxUnitRunner.
Syntax:
- Parameters:
TestContext
or none - Return type:
Future
orvoid
- Supported methods:
@Test
,@Before
,@After
,@BeforeClass
,@AfterClass
@RunWith(FutureVertxRunner.class)
public class MyTest {
@BeforeClass
public static Future setUpClass() {
return Future.succeededFuture();
}
@Before
public Future setUp() {
return Future.succeededFuture();
}
@Test
public Future testFutureResult(TestContext context) {
return Future.succeededFuture();
}
@After
public Future tearDown() {
return Future.succeededFuture();
}
@AfterClass
public static Future tearDownClass() {
return Future.succeededFuture();
}
}
Success:
@Test
public Future testSuccess() {
return Future.succeededFuture();
}
Failure:
@Test
public Future testFailure() {
return Future.failedFuture("error");
}
Incomplete (timeout):
@Test
public static Future testTimeout() {
return Future.future(); // incomplete future
}
Returning null
will behave like a void
return type:
@Test
public Future testNormal() {
return null; // success
}