Skip to content

Commit

Permalink
test: complete behavioral test suite for OpenIDConnectionUtils
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <marc@marcnuri.com>
  • Loading branch information
manusa committed Apr 17, 2024
1 parent 1a1508c commit 64db0b0
Show file tree
Hide file tree
Showing 3 changed files with 383 additions and 4 deletions.
Expand Up @@ -17,7 +17,6 @@

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.opentest4j.AssertionFailedError;

import java.net.URI;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -67,7 +66,7 @@ public synchronized CompletableFuture<WebSocketResponse> buildWebSocketDirect(
future = find(standardWebSocketBuilder.asHttpRequest().uri()).wsFutures.poll()
.get(standardWebSocketBuilder, listener);
} catch (Exception e) {
throw new AssertionFailedError("Unexpected exception", e);
throw new AssertionError("Unexpected exception", e);
}
recordedBuildWebSocketDirects.add(new RecordedBuildWebSocketDirect(standardWebSocketBuilder, listener, future));
return future;
Expand All @@ -80,7 +79,7 @@ public synchronized CompletableFuture<HttpResponse<AsyncBody>> consumeBytesDirec
try {
future = find(request.uri()).futures.poll().get(request, consumer);
} catch (Exception e) {
throw new AssertionFailedError("Unexpected exception", e);
throw new AssertionError("Unexpected exception", e);
}
recordedConsumeBytesDirects.add(new RecordedConsumeBytesDirect(request, consumer, future));
return future;
Expand All @@ -98,7 +97,7 @@ private Expectation find(URI uri) {
return e.getValue();
}
}
throw new AssertionFailedError("Missing expectation for path: " + path);
throw new AssertionError("Missing expectation for path: " + path);
}

public final TestStandardHttpClient expect(String pathRegex, Throwable exception) {
Expand Down
Expand Up @@ -19,6 +19,8 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;

import javax.net.ssl.TrustManager;

public class TestStandardHttpClientBuilder
extends StandardHttpClientBuilder<TestStandardHttpClient, TestStandardHttpClientFactory, TestStandardHttpClientBuilder> {

Expand Down Expand Up @@ -51,4 +53,7 @@ public TestStandardHttpClientBuilder tag(Object value) {
return (TestStandardHttpClientBuilder) super.tag(value);
}

public final TrustManager[] getTrustManagers() {
return trustManagers;
}
}

0 comments on commit 64db0b0

Please sign in to comment.