eclipse-vertx / eclipse-vertx/vert.x

Issue with testcontext documentation (all versions)

Open
#6,139 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
14.7k
Forks
2.1k
Avg merge
1d 10h
Merged PRs (30d)
27

Description

### Version

5.X.X

### Context

In the documentation for version 4 and 5, when mentioning using assertions
https://vertx.io/docs/vertx-junit5/java/#_use_any_assertion_library

it lists that you should use:
```
.onComplete(testContext.succeeding(buffer -> testContext.verify(() -> {
assertThat(buffer.toString()).isEqualTo("Plop");
testContext.completeNow();
})));
```

From my understanding of VertxTestContext, the testContext.verify is redundant, since succeeding, and failing both have try catches similar to verify
I propose the documentation should instead be:
```
.onComplete(testContext.succeeding(buffer -> {
assertThat(buffer.toString()).isEqualTo("Plop");
testContext.completeNow();
}));
```

Whilst not a breaking bug of any kind, this documentation would be better with brevity and less nested lambdas, though this is a matter of taste!
I am happy to contribute a fix to the docs if no-one on the vertx team has time to prioritize such an enhancement.

If my understanding of testContext is wrong, please forgive my lack of knowledge.

### Steps to reproduce

_No response_

### Do you have a reproducer?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.