1717
1818package org .openqa .selenium .remote .http .jdk ;
1919
20- import org .openqa .selenium .remote .http .HttpClient ;
21- import org .openqa .selenium .remote .internal .HttpClientTestBase ;
22- import org .junit .Test ;
2320import static org .hamcrest .MatcherAssert .assertThat ;
24- import static org .hamcrest .Matchers .is ;
25- import static org .hamcrest .Matchers .isNull ;
2621
2722import java .net .URI ;
2823import java .net .URISyntaxException ;
24+ import org .junit .Test ;
25+ import org .openqa .selenium .remote .http .HttpClient ;
26+ import org .openqa .selenium .remote .internal .HttpClientTestBase ;
2927
3028class JdkHttpClientTest extends HttpClientTestBase {
3129
@@ -38,12 +36,12 @@ protected HttpClient.Factory createFactory() {
3836 void shouldStripCredentialsFromUrl () throws URISyntaxException {
3937 URI originalUri = new URI ("http://admin:password@localhost:4444/wd/hub" );
4038 ClientConfig config = ClientConfig .defaultConfig ().baseUri (originalUri );
41-
39+
4240 JdkHttpClient client = new JdkHttpClient (config );
43-
41+
4442 // Get the modified URI from the client's config
4543 URI modifiedUri = client .getBaseUri ();
46-
44+
4745 assertThat (modifiedUri .getUserInfo ()).isNull ();
4846 assertThat (modifiedUri .getHost ()).isEqualTo ("localhost" );
4947 assertThat (modifiedUri .getPort ()).isEqualTo (4444 );
@@ -54,24 +52,23 @@ void shouldStripCredentialsFromUrl() throws URISyntaxException {
5452 void shouldHandleUrlWithoutCredentials () throws URISyntaxException {
5553 URI originalUri = new URI ("http://localhost:4444/wd/hub" );
5654 ClientConfig config = ClientConfig .defaultConfig ().baseUri (originalUri );
57-
55+
5856 JdkHttpClient client = new JdkHttpClient (config );
59-
57+
6058 URI modifiedUri = client .getBaseUri ();
61-
59+
6260 assertThat (modifiedUri ).isEqualTo (originalUri );
6361 }
6462
6563 @ Test
6664 void shouldPreserveUrlComponentsExceptCredentials () throws URISyntaxException {
67- URI originalUri = new URI (
68- "https://admin:password@localhost:4444/wd/hub?debug=true#fragment" );
65+ URI originalUri = new URI ("https://admin:password@localhost:4444/wd/hub?debug=true#fragment" );
6966 ClientConfig config = ClientConfig .defaultConfig ().baseUri (originalUri );
70-
67+
7168 JdkHttpClient client = new JdkHttpClient (config );
72-
69+
7370 URI modifiedUri = client .getBaseUri ();
74-
71+
7572 assertThat (modifiedUri .getScheme ()).isEqualTo ("https" );
7673 assertThat (modifiedUri .getUserInfo ()).isNull ();
7774 assertThat (modifiedUri .getHost ()).isEqualTo ("localhost" );
0 commit comments