1111import java .util .HashMap ;
1212import java .util .Map ;
1313
14- import static org .junit .jupiter .api .Assertions .*;
1514import static org .hamcrest .MatcherAssert .assertThat ;
15+ import static org .hamcrest .Matchers .is ;
16+ import static org .junit .jupiter .api .Assertions .assertAll ;
17+ import static org .junit .jupiter .api .Assertions .assertThrows ;
1618
1719/**
1820 * Tests for {@link DefaultImportScanService}
@@ -64,8 +66,8 @@ void constructorShouldThrowExceptionOnNullConfig() {
6466 void createDefectDojoAuthorizationHeaders_apiKeyFromConfigShouldBePresentAsAuthHEader () {
6567 final var authorizationHeaders = sut .createDefectDojoAuthorizationHeaders ();
6668 assertAll (
67- () -> assertEquals ( 1 , authorizationHeaders .size (), "Expected is exactly one authorization header!" ),
68- () -> assertEquals ( "Token apiKey" , authorizationHeaders .get (HttpHeaders .AUTHORIZATION ).get (0 ))
69+ () -> assertThat ( authorizationHeaders .size (), is ( 1 ) ),
70+ () -> assertThat ( authorizationHeaders .get (HttpHeaders .AUTHORIZATION ).get (0 ), is ( "Token apiKey" ))
6971 );
7072 }
7173
@@ -74,31 +76,31 @@ void shouldConfigureProxySettings_falseIfNeitherUserNorPasswordIsSet() {
7476 System .clearProperty (ProxyConfigNames .HTTP_PROXY_USER .getLiterat ());
7577 System .clearProperty (ProxyConfigNames .HTTP_PROXY_PASSWORD .getLiterat ());
7678
77- assertFalse (sut .shouldConfigureProxySettings ());
79+ assertThat (sut .shouldConfigureProxySettings (), is ( false ));
7880 }
7981
8082 @ Test
8183 void shouldConfigureProxySettings_falseIfUserSetButPasswordNot () {
8284 System .setProperty (ProxyConfigNames .HTTP_PROXY_USER .getLiterat (), "user" );
8385 System .clearProperty (ProxyConfigNames .HTTP_PROXY_PASSWORD .getLiterat ());
8486
85- assertFalse (sut .shouldConfigureProxySettings ());
87+ assertThat (sut .shouldConfigureProxySettings (), is ( false ));
8688 }
8789
8890 @ Test
8991 void shouldConfigureProxySettings_falseIfPasswordSetButUserNot () {
9092 System .clearProperty (ProxyConfigNames .HTTP_PROXY_USER .getLiterat ());
9193 System .setProperty (ProxyConfigNames .HTTP_PROXY_PASSWORD .getLiterat (), "password" );
9294
93- assertFalse (sut .shouldConfigureProxySettings ());
95+ assertThat (sut .shouldConfigureProxySettings (), is ( false ));
9496 }
9597
9698 @ Test
9799 void shouldConfigureProxySettings_trueIfUserAndPasswordSet () {
98100 System .setProperty (ProxyConfigNames .HTTP_PROXY_USER .getLiterat (), "user" );
99101 System .setProperty (ProxyConfigNames .HTTP_PROXY_PASSWORD .getLiterat (), "password" );
100102
101- assertTrue (sut .shouldConfigureProxySettings ());
103+ assertThat (sut .shouldConfigureProxySettings (), is ( true ));
102104 }
103105
104106 @ Test
@@ -112,7 +114,7 @@ void createRequestFactoryWithProxyAuthConfig_throesExceptionIfUserNotSet() {
112114 MissingProxyAuthenticationConfig .class ,
113115 sut ::createRequestFactoryWithProxyAuthConfig );
114116
115- assertEquals ( "Expected System property 'http.proxyUser' not set!" , thrown . getMessage ( ));
117+ assertThat ( thrown . getMessage (), is ( "Expected System property 'http.proxyUser' not set!" ));
116118 }
117119
118120 @ Test
@@ -126,7 +128,7 @@ void createRequestFactoryWithProxyAuthConfig_throesExceptionIfPasswordNotSet() {
126128 MissingProxyAuthenticationConfig .class ,
127129 sut ::createRequestFactoryWithProxyAuthConfig );
128130
129- assertEquals ( "Expected System property 'http.proxyPassword' not set!" , thrown . getMessage ( ));
131+ assertThat ( thrown . getMessage (), is ( "Expected System property 'http.proxyPassword' not set!" ));
130132 }
131133
132134 @ Test
@@ -140,7 +142,7 @@ void createRequestFactoryWithProxyAuthConfig_throesExceptionIfHostNotSet() {
140142 MissingProxyAuthenticationConfig .class ,
141143 sut ::createRequestFactoryWithProxyAuthConfig );
142144
143- assertEquals ( "Expected System property 'http.proxyHost' not set!" , thrown . getMessage ( ));
145+ assertThat ( thrown . getMessage (), is ( "Expected System property 'http.proxyHost' not set!" ));
144146 }
145147
146148 @ Test
@@ -154,7 +156,7 @@ void createRequestFactoryWithProxyAuthConfig_throesExceptionIfPortNotSet() {
154156 MissingProxyAuthenticationConfig .class ,
155157 sut ::createRequestFactoryWithProxyAuthConfig );
156158
157- assertEquals ( "Expected System property 'http.proxyPort' not set!" , thrown . getMessage ( ));
159+ assertThat ( thrown . getMessage (), is ( "Expected System property 'http.proxyPort' not set!" ));
158160 }
159161
160162 @ Test
0 commit comments