Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
edmocosta committed Nov 28, 2023
1 parent 967734c commit f0f454c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public SslSimpleBuilder setTrustStore(String trustStoreType, String trustStoreFi
);

if (!hasTrustStoreEntry(this.trustStore)) {
logger.warn("The provided Trust Store file does not contains any trusted certificate entry: {}. Please confirm this is the correct certificate and the password is correct", trustStoreFile);
throw new IllegalArgumentException(String.format("The provided Trust Store file does not contains any trusted certificate entry: %s", trustStoreFile));
}

return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@ void testSetTrustStoreWithNullTrustStoreType() throws Exception {
assertEquals(TRUSTSTORE_TYPE, sslSimpleBuilder.getTrustStore().getType());
}

@Test
void testSetTrustStoreWithNoTrustedCertificate() {
assertThrows(
IllegalArgumentException.class,
() -> createPemSslSimpleBuilder().setTrustStore(KEYSTORE_TYPE, KEYSTORE, KEYSTORE_PASSWORD),
String.format("The provided Trust Store file does not contains any trusted certificate entry: %s", KEYSTORE)
);
}

@Test
void testDefaultVerifyModeIsNone() {
final SslSimpleBuilder sslSimpleBuilder = createPemSslSimpleBuilder();
Expand Down

0 comments on commit f0f454c

Please sign in to comment.