@@ -116,7 +116,7 @@ void trustManagerWillNotBeReloadedIfNullIsProvidedAsNewCertificate() {
116116 assertThat (trustManager .getInnerTrustManager ()).isInstanceOf (DummyX509ExtendedTrustManager .class );
117117
118118 assertThat (trustManager .getAcceptedIssuers ()).isEmpty ();
119- assertThat (logCaptor .getLogs ()).isEmpty ( );
119+ assertThat (logCaptor .getLogs ()).containsExactly ( "No trust store path has been specified. Creating an empty in-memory trust store" );
120120 }
121121
122122 @ Test
@@ -130,7 +130,7 @@ void trustManagerWillNotBeReloadedIfEmptyListIsProvidedAsNewCertificate() {
130130 assertThat (trustManager .getInnerTrustManager ()).isInstanceOf (DummyX509ExtendedTrustManager .class );
131131
132132 assertThat (trustManager .getAcceptedIssuers ()).isEmpty ();
133- assertThat (logCaptor .getLogs ()).isEmpty ( );
133+ assertThat (logCaptor .getLogs ()).containsExactly ( "No trust store path has been specified. Creating an empty in-memory trust store" );
134134 }
135135
136136 @ Test
@@ -156,9 +156,11 @@ void errorLogIfItCanNotSaveNewlyAddedTrustedCertificatesToTheInMemoryTrustStore(
156156 trustManager .addCertificates (Arrays .asList (trustedCerts ));
157157
158158 List <LogEvent > logEvents = logCaptor .getLogEvents ();
159- assertThat (logEvents ).hasSize (1 );
160- assertThat (logEvents .get (0 ).getLevel ()).isEqualTo ("ERROR" );
161- assertThat (logEvents .get (0 ).getFormattedMessage ()).contains ("Cannot add certificate" );
159+ assertThat (logEvents ).hasSize (2 );
160+ assertThat (logEvents .get (0 ).getFormattedMessage ()).contains ("No trust store path has been specified. Creating an empty in-memory trust store" );
161+
162+ assertThat (logEvents .get (1 ).getLevel ()).isEqualTo ("ERROR" );
163+ assertThat (logEvents .get (1 ).getFormattedMessage ()).contains ("Cannot add certificate" );
162164 }
163165 }
164166
@@ -564,9 +566,12 @@ void wrapKeyStoreExceptionIntoGenericKeyStoreExceptionWhenCallingGenerateAlias()
564566 assertThat (trustManager .getAcceptedIssuers ()).hasSize (1 );
565567
566568 List <LogEvent > logEvents = logCaptor .getLogEvents ();
567- assertThat (logEvents ).hasSize (1 );
569+ assertThat (logEvents ).hasSize (3 );
570+
571+ assertThat (logEvents .get (0 ).getMessage ()).contains ("Trying to load the trust store from" );
572+ assertThat (logEvents .get (1 ).getMessage ()).contains ("Trust store loaded successfully" );
568573
569- LogEvent logEvent = logEvents .get (0 );
574+ LogEvent logEvent = logEvents .get (2 );
570575 assertThat (logEvent .getLevel ()).isEqualTo ("ERROR" );
571576 assertThat (logEvent .getMessage ()).isEqualTo ("Cannot add certificate" );
572577 assertThat (logEvent .getThrowable ()).isPresent ();
0 commit comments