From e8c88bb9eb553da525076d933d5e183586b5435f Mon Sep 17 00:00:00 2001 From: Dinu John <86094133+dinujoh@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:46:02 -0600 Subject: [PATCH] Update unit test to include actual random values Signed-off-by: Dinu John <86094133+dinujoh@users.noreply.github.com> --- .../kafka/util/CustomClientSslEngineFactoryTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/data-prepper-plugins/kafka-plugins/src/test/java/org/opensearch/dataprepper/plugins/kafka/util/CustomClientSslEngineFactoryTest.java b/data-prepper-plugins/kafka-plugins/src/test/java/org/opensearch/dataprepper/plugins/kafka/util/CustomClientSslEngineFactoryTest.java index 6056f4c35e..a149fb840d 100644 --- a/data-prepper-plugins/kafka-plugins/src/test/java/org/opensearch/dataprepper/plugins/kafka/util/CustomClientSslEngineFactoryTest.java +++ b/data-prepper-plugins/kafka-plugins/src/test/java/org/opensearch/dataprepper/plugins/kafka/util/CustomClientSslEngineFactoryTest.java @@ -8,10 +8,10 @@ import java.nio.file.Path; import java.util.Collections; import java.util.Objects; +import java.util.UUID; +import java.util.concurrent.ThreadLocalRandom; import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; @@ -19,7 +19,8 @@ public class CustomClientSslEngineFactoryTest { @Test public void createClientSslEngine() { try (final CustomClientSslEngineFactory customClientSslEngineFactory = new CustomClientSslEngineFactory()) { - final SSLEngine sslEngine = customClientSslEngineFactory.createClientSslEngine(anyString(), anyInt(), anyString()); + final SSLEngine sslEngine = customClientSslEngineFactory.createClientSslEngine( + UUID.randomUUID().toString(), ThreadLocalRandom.current().nextInt(), UUID.randomUUID().toString()); assertThat(sslEngine, is(notNullValue())); } } @@ -32,7 +33,8 @@ public void createClientSslEngineWithConfig() throws IOException { final String certificateContent = Files.readString(certFilePath); customClientSslEngineFactory.configure(Collections.singletonMap("certificateContent", certificateContent)); - final SSLEngine sslEngine = customClientSslEngineFactory.createClientSslEngine(anyString(), anyInt(), anyString()); + final SSLEngine sslEngine = customClientSslEngineFactory.createClientSslEngine( + UUID.randomUUID().toString(), ThreadLocalRandom.current().nextInt(), UUID.randomUUID().toString()); assertThat(sslEngine, is(notNullValue())); } }