|
1 | 1 | package io.scalecube.services; |
2 | 2 |
|
3 | 3 | import static org.junit.jupiter.api.Assertions.assertThrows; |
4 | | -import static reactor.core.publisher.Mono.from; |
5 | 4 |
|
6 | | -import io.scalecube.services.api.ServiceMessage; |
7 | 5 | import io.scalecube.services.discovery.ScalecubeServiceDiscovery; |
8 | 6 | import io.scalecube.services.exceptions.BadRequestException; |
9 | 7 | import io.scalecube.services.exceptions.ForbiddenException; |
|
17 | 15 | import org.junit.jupiter.api.AfterAll; |
18 | 16 | import org.junit.jupiter.api.BeforeAll; |
19 | 17 | import org.junit.jupiter.api.Test; |
20 | | -import org.reactivestreams.Publisher; |
21 | 18 | import reactor.test.StepVerifier; |
22 | 19 |
|
23 | 20 | public class ErrorFlowTest extends BaseTest { |
@@ -67,27 +64,35 @@ public static void shutdownNodes() { |
67 | 64 |
|
68 | 65 | @Test |
69 | 66 | public void testCorruptedRequest() { |
70 | | - Publisher<ServiceMessage> req = |
71 | | - consumer |
72 | | - .call() |
73 | | - .requestOne(TestRequests.GREETING_CORRUPTED_PAYLOAD_REQUEST, GreetingResponse.class); |
74 | | - assertThrows(InternalServiceException.class, () -> from(req).block()); |
| 67 | + assertThrows( |
| 68 | + InternalServiceException.class, |
| 69 | + () -> |
| 70 | + consumer |
| 71 | + .call() |
| 72 | + .requestOne(TestRequests.GREETING_CORRUPTED_PAYLOAD_REQUEST, GreetingResponse.class) |
| 73 | + .block()); |
75 | 74 | } |
76 | 75 |
|
77 | 76 | @Test |
78 | 77 | public void testNotAuthorized() { |
79 | | - Publisher<ServiceMessage> req = |
80 | | - consumer |
81 | | - .call() |
82 | | - .requestOne(TestRequests.GREETING_UNAUTHORIZED_REQUEST, GreetingResponse.class); |
83 | | - assertThrows(ForbiddenException.class, () -> from(req).block()); |
| 78 | + assertThrows( |
| 79 | + ForbiddenException.class, |
| 80 | + () -> |
| 81 | + consumer |
| 82 | + .call() |
| 83 | + .requestOne(TestRequests.GREETING_UNAUTHORIZED_REQUEST, GreetingResponse.class) |
| 84 | + .block()); |
84 | 85 | } |
85 | 86 |
|
86 | 87 | @Test |
87 | 88 | public void testNullRequestPayload() { |
88 | | - Publisher<ServiceMessage> req = |
89 | | - consumer.call().requestOne(TestRequests.GREETING_NULL_PAYLOAD, GreetingResponse.class); |
90 | | - assertThrows(BadRequestException.class, () -> from(req).block()); |
| 89 | + assertThrows( |
| 90 | + BadRequestException.class, |
| 91 | + () -> |
| 92 | + consumer |
| 93 | + .call() |
| 94 | + .requestOne(TestRequests.GREETING_NULL_PAYLOAD, GreetingResponse.class) |
| 95 | + .block()); |
91 | 96 | } |
92 | 97 |
|
93 | 98 | @Test |
|
0 commit comments