|
16 | 16 |
|
17 | 17 | import io.vrap.rmf.base.client.*; |
18 | 18 | import io.vrap.rmf.base.client.error.*; |
19 | | -import io.vrap.rmf.base.client.oauth2.TokenSupplier; |
20 | 19 |
|
21 | 20 | import org.assertj.core.api.Assertions; |
22 | | -import org.junit.jupiter.api.Test; |
23 | 21 | import org.junit.jupiter.api.TestTemplate; |
24 | 22 | import org.junit.jupiter.api.extension.ExtendWith; |
25 | 23 |
|
@@ -77,34 +75,6 @@ public void testHttpCounts(int statusCode, int count, int errorCount) throws URI |
77 | 75 | Assertions.assertThat(middleware.errorCount).isEqualTo(errorCount); |
78 | 76 | } |
79 | 77 |
|
80 | | - @Test |
81 | | - public void testUnauthorized() throws URISyntaxException { |
82 | | - TestTelemetryMiddleware middleware = new TestTelemetryMiddleware(); |
83 | | - |
84 | | - ApiHttpClient client = ClientBuilder |
85 | | - .of(new TestHttpClient(request -> CompletableFuture |
86 | | - .completedFuture(new ApiHttpResponse<>(200, new ApiHttpHeaders(), "".getBytes())))) |
87 | | - .withApiBaseUrl(new URI("")) |
88 | | - .withTokenSupplier((TokenSupplier) () -> { |
89 | | - throw new UnauthorizedException(401, "", null, "", null); |
90 | | - }) |
91 | | - .withTelemetryMiddleware(middleware) |
92 | | - .withErrorMiddleware() |
93 | | - .build(); |
94 | | - |
95 | | - final ApiHttpRequest request = new ApiHttpRequest(ApiHttpMethod.GET, URI.create("/"), new ApiHttpHeaders(), |
96 | | - "".getBytes()); |
97 | | - try { |
98 | | - blockingWait(client.execute(request), Duration.ofSeconds(1)); |
99 | | - } |
100 | | - catch (ApiHttpException ignored) { |
101 | | - int i = 1; |
102 | | - } |
103 | | - |
104 | | - Assertions.assertThat(middleware.count).isEqualTo(1); |
105 | | - Assertions.assertThat(middleware.errorCount).isEqualTo(1); |
106 | | - } |
107 | | - |
108 | 78 | static class TestHttpClient implements VrapHttpClient { |
109 | 79 | private final Function<ApiHttpRequest, CompletableFuture<ApiHttpResponse<byte[]>>> next; |
110 | 80 |
|
|
0 commit comments