public class RunTestOnContext extends Object implements org.junit.rules.TestRule
Rule
a new context is created for each tested method, the context will be same
for the before and after method, but different for all the tested methods.
When used as a ClassRule
, a single context is created for all the tested method, the beforeClass
and afterClass method will also executed in this context.Constructor and Description |
---|
RunTestOnContext()
Create a new rule managing a Vertx instance created with default options.
|
RunTestOnContext(Future<Vertx> createVertx)
Create a new rule with an asynchronous supplier for creating a Vert.x instance.
|
RunTestOnContext(Future<Vertx> createVertx,
java.util.function.BiConsumer<Vertx,java.util.function.Consumer<Void>> closeVertx)
Create a new rule with an asynchronous supplier and consumer for creating and closing a Vert.x instance.
|
RunTestOnContext(java.util.function.Supplier<Vertx> createVertx)
Create a new rule with supplier for creating a Vert.x instance.
|
RunTestOnContext(java.util.function.Supplier<Vertx> createVertx,
java.util.function.BiConsumer<Vertx,java.util.function.Consumer<Void>> closeVertx)
Create a new rule with supplier/consumer for creating/closing a Vert.x instance.
|
RunTestOnContext(VertxOptions options)
Create a new rule managing a Vertx instance created with specified options.
|
Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
Vertx |
vertx()
Retrieves the current Vert.x instance, this value varies according to the test life cycle.
|
public RunTestOnContext()
public RunTestOnContext(VertxOptions options)
options
- the vertx optionspublic RunTestOnContext(java.util.function.Supplier<Vertx> createVertx)
createVertx
- the create Vert.x supplierpublic RunTestOnContext(java.util.function.Supplier<Vertx> createVertx, java.util.function.BiConsumer<Vertx,java.util.function.Consumer<Void>> closeVertx)
closeVertx
lambda should invoke the consumer with null when the vertx
instance is closed.createVertx
- the create Vert.x suppliercloseVertx
- the close Vert.x consumerpublic RunTestOnContext(Future<Vertx> createVertx)
createVertx
- the asynchronous create Vert.x supplierpublic RunTestOnContext(Future<Vertx> createVertx, java.util.function.BiConsumer<Vertx,java.util.function.Consumer<Void>> closeVertx)
closeVertx
lambda should invoke the consumer with null when the
vertx
instance is closed.createVertx
- the asynchronous Vert.x suppliercloseVertx
- the close Vert.x consumerpublic Vertx vertx()
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
apply
in interface org.junit.rules.TestRule
Copyright © 2021 Eclipse. All rights reserved.