-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace future.andThen(onSuccess(A)) by future.expecting(that(P)) in …
…vertx tests.
- Loading branch information
Showing
15 changed files
with
178 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,8 @@ | |
import java.util.function.BiFunction; | ||
import java.util.zip.GZIPOutputStream; | ||
|
||
import static io.vertx.test.core.AssertExpectations.that; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Julien Viet</a> | ||
*/ | ||
|
@@ -1070,10 +1072,8 @@ public void testReceivingGoAwayDiscardsTheConnection() throws Exception { | |
vertx.runOnContext(v -> { | ||
client.request(new RequestOptions(requestOptions).setTimeout(5000)) | ||
.compose(HttpClientRequest::send) | ||
.onComplete(onSuccess(resp2 -> { | ||
assertEquals(2, connections.size()); | ||
testComplete(); | ||
})); | ||
.expecting(that(v2 -> assertEquals(2, connections.size()))) | ||
.onComplete(onSuccess(resp2 -> testComplete())); | ||
}); | ||
}); | ||
req.send().onComplete(onFailure(resp -> { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,8 @@ | |
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
import static io.vertx.test.core.AssertExpectations.that; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Julien Viet</a> | ||
*/ | ||
|
@@ -72,7 +74,7 @@ public void testServerResponseWriteBufferFromOtherThread() throws Exception { | |
startServer(testAddress); | ||
client.request(requestOptions).compose(req -> req | ||
.send() | ||
.andThen(onSuccess(resp -> assertEquals(200, resp.statusCode()))) | ||
.expecting(that(resp -> assertEquals(200, resp.statusCode()))) | ||
.compose(HttpClientResponse::body)). | ||
onComplete(onSuccess(body -> { | ||
assertEquals(Buffer.buffer("hello world"), body); | ||
|
@@ -91,7 +93,7 @@ public void testServerResponseEndFromOtherThread() throws Exception { | |
startServer(testAddress); | ||
client.request(requestOptions).compose(req -> req | ||
.send() | ||
.andThen(onSuccess(resp -> assertEquals(200, resp.statusCode()))) | ||
.expecting(HttpResponseExpectation.SC_OK) | ||
.compose(HttpClientResponse::end)) | ||
.onComplete(onSuccess(v -> testComplete())); | ||
await(); | ||
|
@@ -107,8 +109,8 @@ public void testServerResponseEndWithTrailersFromOtherThread() throws Exception | |
startServer(testAddress); | ||
client.request(requestOptions).compose(req -> req | ||
.send() | ||
.andThen(onSuccess(resp -> assertEquals(200, resp.statusCode()))) | ||
.compose(resp -> resp.end().andThen(onSuccess(v -> { | ||
.expecting(HttpResponseExpectation.SC_OK) | ||
.compose(resp -> resp.end().expecting(that(v -> { | ||
assertEquals(1, resp.trailers().size()); | ||
assertEquals("trailer", resp.trailers().get("some")); | ||
})))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.