Skip to content

Commit

Permalink
Update unit test to include actual random values
Browse files Browse the repository at this point in the history
Signed-off-by: Dinu John <[email protected]>
  • Loading branch information
dinujoh committed Feb 23, 2024
1 parent 67b95e2 commit e8c88bb
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@
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;

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()));
}
}
Expand All @@ -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()));
}
}
Expand Down

0 comments on commit e8c88bb

Please sign in to comment.