vert-x3 / vert-x3/vertx-examples
Junit non-REST test example
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 2k
- Avg merge
- 24d 51m
- Merged PRs (30d)
- 1
Description
I am struggling to test a verticle isolated and all documentation and examples found only show how to test rest endpoints.
Something as simple as this, always fails with timeout
@Rule
public RunTestOnContext rule = new RunTestOnContext();
@Rule
public Timeout timeout = Timeout.seconds(5L);
@Test
public void should_run_verticle(TestContext context) {
// given
final String address = "hello";
final String message = "world";
// when
final Async async = context.async();
rule.vertx()
.eventBus()
.publish(address, message)
.consumer(address, event -> {
context.assertEquals(message, event.body());
System.out.println(event.body());
async.complete();
});
async.awaitSuccess();
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the existing Java testing examples and documentation, which currently focus on REST endpoints, then compare them with the RunTestOnContext and event-bus snippet in this issue. Determine the supported pattern for testing an isolated verticle and add a non-REST JUnit example that completes successfully without timing out.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, testing-qa
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100