summaryrefslogtreecommitdiffstats
path: root/container-core
diff options
context:
space:
mode:
authorrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>2023-08-29 17:02:12 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-08-29 23:37:31 +0200
commit9ad528fdbc466133b67d55baadf1c01181cefea3 (patch)
treebf7b540188f9a64d99ac8b9f4cb6ff579c25dab1 /container-core
parent306dce28ed3cfa0d2f4679fd2519db3d1ac780c7 (diff)
- Update dependency org.jvnet.mimepull:mimepull to v1.10.0
- Update dependency org.apache.opennlp:opennlp-tools to v1.9.4 - Use dependency-versions - Bring jimfs up to date. - Bring some more libraries up-2-date. - Reduce usage of assertj
Diffstat (limited to 'container-core')
-rw-r--r--container-core/pom.xml5
-rw-r--r--container-core/src/test/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandlerTest.java11
-rw-r--r--container-core/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java40
-rw-r--r--container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/FilterTestCase.java4
-rw-r--r--container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java54
-rw-r--r--container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/ProxyProtocolTest.java13
-rw-r--r--container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeMetricsTest.java15
7 files changed, 64 insertions, 78 deletions
diff --git a/container-core/pom.xml b/container-core/pom.xml
index b3794142d0e..3df232406ca 100644
--- a/container-core/pom.xml
+++ b/container-core/pom.xml
@@ -390,11 +390,6 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
diff --git a/container-core/src/test/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandlerTest.java b/container-core/src/test/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandlerTest.java
index 86b7f545762..8590983d0ad 100644
--- a/container-core/src/test/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandlerTest.java
+++ b/container-core/src/test/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandlerTest.java
@@ -7,7 +7,8 @@ import org.junit.jupiter.api.Test;
import java.util.concurrent.Executors;
-import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author bjorncs
@@ -22,10 +23,10 @@ public class ThreadedHttpRequestHandlerTest {
driver.sendRequest("http://localhost/myhandler").readAll();
String expectedMetricName = "jdisc.http.handler.unhandled_exceptions";
- assertThat(metricMock.innvocations())
- .containsKey(expectedMetricName);
- assertThat(((MetricMock.SimpleMetricContext) metricMock.innvocations().get(expectedMetricName).ctx).dimensions)
- .containsEntry("exception", "DummyException");
+ assertTrue(metricMock.innvocations()
+ .containsKey(expectedMetricName));
+ assertEquals("DummyException",
+ ((MetricMock.SimpleMetricContext) metricMock.innvocations().get(expectedMetricName).ctx).dimensions.get("exception"));
}
diff --git a/container-core/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java b/container-core/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java
index b5c65733436..220c09481c2 100644
--- a/container-core/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java
+++ b/container-core/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java
@@ -25,8 +25,10 @@ import java.util.logging.LogRecord;
import java.util.zip.GZIPInputStream;
import static com.yahoo.yolean.Exceptions.uncheck;
-import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Bob Travis
@@ -50,8 +52,8 @@ public class LogFileHandlerTestCase {
long tomorrowDays = (now / millisPerDay) + 1;
long tomorrowMillis = tomorrowDays * millisPerDay;
- assertThat(tomorrowMillis + 1000).isEqualTo(h.logThread.getNextRotationTime(tomorrowMillis));
- assertThat(tomorrowMillis + 10000).isEqualTo(h.logThread.getNextRotationTime(tomorrowMillis + 3000));
+ assertEquals(tomorrowMillis + 1000, h.logThread.getNextRotationTime(tomorrowMillis));
+ assertEquals(tomorrowMillis + 10000, h.logThread.getNextRotationTime(tomorrowMillis + 3000));
String message = "test";
h.publish(message);
h.publish("another test");
@@ -118,11 +120,11 @@ public class LogFileHandlerTestCase {
String longMessage = formatter.format(new LogRecord(Level.INFO, "string which is way longer than the word test"));
handler.publish(longMessage);
handler.flush();
- assertThat(Files.size(Paths.get(firstFile))).isEqualTo(31);
+ assertEquals(31, Files.size(Paths.get(firstFile)));
final long expectedSecondFileLength = 72;
long symlinkFileLength = Files.size(root.toPath().resolve("symlink"));
- assertThat(symlinkFileLength).isEqualTo(expectedSecondFileLength);
+ assertEquals(expectedSecondFileLength, symlinkFileLength);
handler.shutdown();
}
@@ -135,8 +137,8 @@ public class LogFileHandlerTestCase {
firstHandler.publishAndWait("test");
firstHandler.shutdown();
- assertThat(Files.size(Paths.get(firstHandler.getFileName()))).isEqualTo(5);
- assertThat(root.toPath().resolve("symlink").toRealPath().toString()).isEqualTo(
+ assertEquals(5, Files.size(Paths.get(firstHandler.getFileName())));
+ assertEquals(root.toPath().resolve("symlink").toRealPath().toString(),
Paths.get(firstHandler.getFileName()).toRealPath().toString());
LogFileHandler<String> secondHandler = new LogFileHandler<>(
@@ -144,11 +146,11 @@ public class LogFileHandlerTestCase {
secondHandler.publishAndWait("test");
secondHandler.rotateNow();
- assertThat(root.toPath().resolve("symlink").toRealPath().toString()).isEqualTo(
+ assertEquals(root.toPath().resolve("symlink").toRealPath().toString(),
Paths.get(secondHandler.getFileName()).toRealPath().toString());
while (Files.exists(root.toPath().resolve(firstHandler.getFileName()))) Thread.sleep(1);
- assertThat(Files.exists(Paths.get(firstHandler.getFileName() + ".zst"))).isTrue();
+ assertTrue(Files.exists(Paths.get(firstHandler.getFileName() + ".zst")));
secondHandler.shutdown();
}
@@ -187,20 +189,20 @@ public class LogFileHandlerTestCase {
}
h.flush();
String f1 = h.getFileName();
- assertThat(f1).startsWith(root.getAbsolutePath() + "/logfilehandlertest.");
+ assertTrue(f1.startsWith(root.getAbsolutePath() + "/logfilehandlertest."));
File uncompressed = new File(f1);
File compressed = new File(f1 + "." + fileExtension);
- assertThat(uncompressed).exists();
- assertThat(compressed).doesNotExist();
+ assertTrue(uncompressed.exists());
+ assertFalse(compressed.exists());
String content = IOUtils.readFile(uncompressed);
- assertThat(content).hasLineCount(logEntries);
+ assertEquals(logEntries, content.lines().count());
h.rotateNow();
while (uncompressed.exists()) {
Thread.sleep(1);
}
- assertThat(compressed).exists();
+ assertTrue(compressed.exists());
String uncompressedContent = decompressor.apply(compressed.toPath(), content.getBytes().length);
- assertThat(uncompressedContent).isEqualTo(content);
+ assertEquals(uncompressedContent, content);
h.shutdown();
}
@@ -211,14 +213,6 @@ public class LogFileHandlerTestCase {
outputStream.write(record.getBytes(StandardCharsets.UTF_8));
}
- private static File newFolder(File root, String... subDirs) throws IOException {
- String subFolder = String.join("/", subDirs);
- File result = new File(root, subFolder);
- if (!result.mkdirs()) {
- throw new IOException("Couldn't create folders " + root);
- }
- return result;
- }
}
private static File newFolder(File root, String... subDirs) throws IOException {
diff --git a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/FilterTestCase.java b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/FilterTestCase.java
index ce49926c58b..cc839768ad5 100644
--- a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/FilterTestCase.java
+++ b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/FilterTestCase.java
@@ -28,7 +28,6 @@ import com.yahoo.jdisc.http.filter.ResponseHeaderFilter;
import com.yahoo.jdisc.http.filter.chain.RequestFilterChain;
import com.yahoo.jdisc.http.filter.chain.ResponseFilterChain;
import com.yahoo.jdisc.http.server.jetty.testutils.ConnectorFactoryRegistryModule;
-import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
@@ -44,6 +43,7 @@ import java.util.concurrent.atomic.AtomicReference;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.mock;
@@ -557,7 +557,7 @@ public class FilterTestCase {
.expectStatusCode(is(Response.Status.OK));
ArgumentCaptor<HttpRequest> requestArgumentCaptor = ArgumentCaptor.forClass(HttpRequest.class);
verify(filter).filter(requestArgumentCaptor.capture(), any(ResponseHandler.class));
- Assertions.assertThat(requestArgumentCaptor.getValue().context()).containsKey(RequestHandlerSpec.ATTRIBUTE_NAME);
+ assertTrue(requestArgumentCaptor.getValue().context().containsKey(RequestHandlerSpec.ATTRIBUTE_NAME));
}
private static JettyTestDriver newDriver(MyRequestHandler requestHandler, FilterBindings filterBindings) {
diff --git a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java
index 97237e1c016..c4c9161ccfb 100644
--- a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java
+++ b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java
@@ -38,7 +38,6 @@ import org.apache.hc.client5.http.entity.mime.StringBody;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
import org.apache.hc.core5.http.ConnectionClosedException;
import org.apache.hc.core5.http.ContentType;
-import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
@@ -85,12 +84,11 @@ import static com.yahoo.jdisc.http.server.jetty.Utils.createHttp2Client;
import static com.yahoo.jdisc.http.server.jetty.Utils.createSslTestDriver;
import static com.yahoo.jdisc.http.server.jetty.Utils.generatePrivateKeyAndCertificate;
import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
-import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.matchesPattern;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -127,7 +125,7 @@ public class HttpServerTest {
.listenPort(driver.server().getListenPort())
);
} catch (final Throwable t) {
- assertThat(t.getCause(), instanceOf(BindException.class));
+ assertTrue(t.getCause() instanceof BindException);
}
assertTrue(driver.close());
}
@@ -191,7 +189,7 @@ public class HttpServerTest {
.expectStatusCode(is(REQUEST_URI_TOO_LONG));
RequestLogEntry entry = requestLogMock.poll(Duration.ofSeconds(5));
assertEquals(414, entry.statusCode().getAsInt());
- assertThat(driver.close(), is(true));
+ assertTrue(driver.close());
}
@Test
@@ -473,7 +471,7 @@ public class HttpServerTest {
final JettyTestDriver driver = JettyTestDriver.newInstance(new EchoWithHeaderRequestHandler(CONNECTION, CLOSE));
driver.client().get("/status.html")
.expectHeader(CONNECTION, is(CLOSE));
- assertThat(driver.close(), is(true));
+ assertTrue(driver.close());
}
@Test
@@ -583,7 +581,7 @@ public class HttpServerTest {
driver.client().get("/status.html")
.expectStatusCode(is(OK))
.expectContent(matchesPattern("\\d{13,}"));
- assertThat(driver.close(), is(true));
+ assertTrue(driver.close());
}
@Test
@@ -689,25 +687,25 @@ public class HttpServerTest {
}
assertTrue(driver.close());
List<ConnectionLogEntry> logEntries = connectionLog.logEntries();
- Assertions.assertThat(logEntries).hasSize(1);
+ assertEquals(1, logEntries.size());
ConnectionLogEntry logEntry = logEntries.get(0);
assertEquals(4, UUID.fromString(logEntry.id()).version());
- Assertions.assertThat(logEntry.timestamp()).isAfter(Instant.EPOCH);
- Assertions.assertThat(logEntry.requests()).hasValue(100L);
- Assertions.assertThat(logEntry.responses()).hasValue(100L);
- Assertions.assertThat(logEntry.peerAddress()).hasValue("127.0.0.1");
- Assertions.assertThat(logEntry.localAddress()).hasValue("127.0.0.1");
- Assertions.assertThat(logEntry.localPort()).hasValue(listenPort);
- Assertions.assertThat(logEntry.httpBytesReceived()).hasValueSatisfying(value -> Assertions.assertThat(value).isGreaterThan(100000L));
- Assertions.assertThat(logEntry.httpBytesSent()).hasValueSatisfying(value -> Assertions.assertThat(value).isGreaterThan(10000L));
- Assertions.assertThat(logEntry.sslProtocol()).hasValueSatisfying(TlsContext.ALLOWED_PROTOCOLS::contains);
- Assertions.assertThat(logEntry.sslPeerSubject()).hasValue("CN=localhost");
- Assertions.assertThat(logEntry.sslCipherSuite()).hasValueSatisfying(cipher -> Assertions.assertThat(cipher).isNotBlank());
- Assertions.assertThat(logEntry.sslSessionId()).hasValueSatisfying(sessionId -> Assertions.assertThat(sessionId).hasSize(64));
- Assertions.assertThat(logEntry.sslPeerNotBefore()).hasValue(Instant.EPOCH);
- Assertions.assertThat(logEntry.sslPeerNotAfter()).hasValue(Instant.EPOCH.plus(100_000, ChronoUnit.DAYS));
- Assertions.assertThat(logEntry.sslBytesReceived()).hasValueSatisfying(value -> Assertions.assertThat(value).isGreaterThan(100000L));
- Assertions.assertThat(logEntry.sslBytesSent()).hasValueSatisfying(value -> Assertions.assertThat(value).isGreaterThan(10000L));
+ assertTrue(logEntry.timestamp().isAfter(Instant.EPOCH));
+ assertEquals(100L, logEntry.requests().get());
+ assertEquals(100L, logEntry.responses().get());
+ assertEquals("127.0.0.1", logEntry.peerAddress().get());
+ assertEquals("127.0.0.1", logEntry.localAddress().get());
+ assertEquals(listenPort, logEntry.localPort().get());
+ assertTrue(logEntry.httpBytesReceived().get() > 100000L);
+ assertTrue(logEntry.httpBytesSent().get() > 10000L);
+ assertTrue(TlsContext.ALLOWED_PROTOCOLS.contains(logEntry.sslProtocol().get()));
+ assertEquals("CN=localhost", logEntry.sslPeerSubject().get());
+ assertFalse(logEntry.sslCipherSuite().get().isBlank());
+ assertEquals(64, logEntry.sslSessionId().get().length());
+ assertEquals(Instant.EPOCH, logEntry.sslPeerNotBefore().get());
+ assertEquals(Instant.EPOCH.plus(100_000, ChronoUnit.DAYS), logEntry.sslPeerNotAfter().get());
+ assertTrue(logEntry.sslBytesReceived().get() > 100000L);
+ assertTrue(logEntry.sslBytesSent().get() > 10000L);
}
@Test
@@ -720,9 +718,9 @@ public class HttpServerTest {
binder -> binder.bind(RequestLog.class).toInstance(requestLogMock));
driver.client().newPost("/status.html").setContent("abcdef").execute().expectStatusCode(is(OK));
RequestLogEntry entry = requestLogMock.poll(Duration.ofSeconds(5));
- Assertions.assertThat(entry.statusCode()).hasValue(200);
- Assertions.assertThat(entry.requestSize()).hasValue(6);
- assertThat(driver.close(), is(true));
+ assertEquals(200, entry.statusCode().getAsInt());
+ assertEquals(6, entry.requestSize().getAsLong());
+ assertTrue(driver.close());
}
@Test
@@ -734,7 +732,7 @@ public class HttpServerTest {
InMemoryConnectionLog connectionLog = new InMemoryConnectionLog();
JettyTestDriver driver = createSslTestDriver(certificateFile, privateKeyFile, metricConsumer, connectionLog);
driver.client().get("/").expectStatusCode(is(OK));
- assertThat(driver.close(), is(true));
+ assertTrue(driver.close());
verify(metricConsumer.mockitoMock(), atLeast(1))
.set(MetricDefinitions.REQUESTS_PER_CONNECTION, 1L, MetricConsumerMock.STATIC_CONTEXT);
}
diff --git a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/ProxyProtocolTest.java b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/ProxyProtocolTest.java
index 246b7875692..811a8006720 100644
--- a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/ProxyProtocolTest.java
+++ b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/ProxyProtocolTest.java
@@ -29,7 +29,6 @@ import java.util.logging.Logger;
import static com.yahoo.jdisc.http.server.jetty.Utils.generatePrivateKeyAndCertificate;
import static com.yahoo.yolean.Exceptions.uncheckInterrupted;
-import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.jetty.client.ProxyProtocolClientConnectionFactory.V1;
import static org.eclipse.jetty.client.ProxyProtocolClientConnectionFactory.V2;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -206,14 +205,14 @@ class ProxyProtocolTest {
private static void assertLogEntryHasRemote(ConnectionLogEntry entry, String expectedAddress, int expectedPort) {
if (expectedAddress != null) {
- assertThat(entry.remoteAddress()).hasValue(expectedAddress);
+ assertEquals(expectedAddress, entry.remoteAddress().get());
} else {
- assertThat(entry.remoteAddress()).isEmpty();
+ assertTrue(entry.remoteAddress().isEmpty());
}
if (expectedPort > 0) {
- assertThat(entry.remotePort()).hasValue(expectedPort);
+ assertEquals(expectedPort, entry.remotePort().get());
} else {
- assertThat(entry.remotePort()).isEmpty();
+ assertTrue(entry.remotePort().isEmpty());
}
}
@@ -227,8 +226,8 @@ class ProxyProtocolTest {
await(waitCondition);
assertTrue(driver.close());
if (waitCondition.test(null)) await(waitCondition);
- assertThat(reqLog.entries()).hasSize(expectedReqLogSize);
- assertThat(connLog.logEntries()).hasSize(expectedConnLogSize);
+ assertEquals(expectedReqLogSize, reqLog.entries().size());
+ assertEquals(expectedConnLogSize, connLog.logEntries().size());
}
private static void await(Predicate<Void> waitCondition) {
diff --git a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeMetricsTest.java b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeMetricsTest.java
index 99fa9bb2052..22699efbd46 100644
--- a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeMetricsTest.java
+++ b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeMetricsTest.java
@@ -21,7 +21,6 @@ import java.util.logging.Logger;
import static com.yahoo.jdisc.http.server.jetty.Utils.createSslTestDriver;
import static com.yahoo.jdisc.http.server.jetty.Utils.generatePrivateKeyAndCertificate;
-import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
@@ -59,7 +58,7 @@ class SslHandshakeMetricsTest {
verify(metricConsumer.mockitoMock(), atLeast(1))
.add(MetricDefinitions.SSL_HANDSHAKE_FAILURE_MISSING_CLIENT_CERT, 1L, MetricConsumerMock.STATIC_CONTEXT);
assertTrue(driver.close());
- assertThat(connectionLog.logEntries()).hasSize(1);
+ assertEquals(1, connectionLog.logEntries().size());
assertSslHandshakeFailurePresent(
connectionLog.logEntries().get(0), SSLHandshakeException.class, SslHandshakeFailure.MISSING_CLIENT_CERT.failureType());
}
@@ -82,7 +81,7 @@ class SslHandshakeMetricsTest {
verify(metricConsumer.mockitoMock(), atLeast(1))
.add(MetricDefinitions.SSL_HANDSHAKE_FAILURE_INCOMPATIBLE_PROTOCOLS, 1L, MetricConsumerMock.STATIC_CONTEXT);
assertTrue(driver.close());
- assertThat(connectionLog.logEntries()).hasSize(1);
+ assertEquals(1, connectionLog.logEntries().size());
assertSslHandshakeFailurePresent(
connectionLog.logEntries().get(0), SSLHandshakeException.class, SslHandshakeFailure.INCOMPATIBLE_PROTOCOLS.failureType());
}
@@ -103,7 +102,7 @@ class SslHandshakeMetricsTest {
verify(metricConsumer.mockitoMock(), atLeast(1))
.add(MetricDefinitions.SSL_HANDSHAKE_FAILURE_INCOMPATIBLE_CIPHERS, 1L, MetricConsumerMock.STATIC_CONTEXT);
assertTrue(driver.close());
- assertThat(connectionLog.logEntries()).hasSize(1);
+ assertEquals(1, connectionLog.logEntries().size());
assertSslHandshakeFailurePresent(
connectionLog.logEntries().get(0), SSLHandshakeException.class, SslHandshakeFailure.INCOMPATIBLE_CIPHERS.failureType());
}
@@ -128,7 +127,7 @@ class SslHandshakeMetricsTest {
verify(metricConsumer.mockitoMock(), atLeast(1))
.add(MetricDefinitions.SSL_HANDSHAKE_FAILURE_INVALID_CLIENT_CERT, 1L, MetricConsumerMock.STATIC_CONTEXT);
assertTrue(driver.close());
- assertThat(connectionLog.logEntries()).hasSize(1);
+ assertEquals(1, connectionLog.logEntries().size());
assertSslHandshakeFailurePresent(
connectionLog.logEntries().get(0), SSLHandshakeException.class, SslHandshakeFailure.INVALID_CLIENT_CERT.failureType());
}
@@ -153,7 +152,7 @@ class SslHandshakeMetricsTest {
verify(metricConsumer.mockitoMock(), atLeast(1))
.add(MetricDefinitions.SSL_HANDSHAKE_FAILURE_EXPIRED_CLIENT_CERT, 1L, MetricConsumerMock.STATIC_CONTEXT);
assertTrue(driver.close());
- assertThat(connectionLog.logEntries()).hasSize(1);
+ assertEquals(1, connectionLog.logEntries().size());
}
@@ -169,7 +168,7 @@ class SslHandshakeMetricsTest {
client.get("/status.html");
fail("SSLHandshakeException expected");
} catch (SSLHandshakeException e) {
- assertThat(e.getMessage()).contains(expectedExceptionSubstring);
+ assertTrue(e.getMessage().contains(expectedExceptionSubstring));
} catch (SocketException | SSLException e) {
// This exception is thrown if Apache httpclient's write thread detects the handshake failure before the read thread.
var msg = e.getMessage();
@@ -182,7 +181,7 @@ class SslHandshakeMetricsTest {
private static void assertSslHandshakeFailurePresent(
ConnectionLogEntry entry, Class<? extends SSLHandshakeException> expectedException, String expectedType) {
- assertThat(entry.sslHandshakeFailure()).isPresent();
+ assertTrue(entry.sslHandshakeFailure().isPresent());
ConnectionLogEntry.SslHandshakeFailure failure = entry.sslHandshakeFailure().get();
assertEquals(expectedType, failure.type());
ConnectionLogEntry.SslHandshakeFailure.ExceptionEntry exceptionEntry = failure.exceptionChain().get(0);