File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 1919import java .net .URI ;
2020import java .net .URISyntaxException ;
2121
22+ import org .junit .jupiter .api .BeforeEach ;
2223import org .junit .jupiter .api .Test ;
2324
2425import org .springframework .web .util .UriBuilder ;
3637 */
3738class RootUriBuilderFactoryTests {
3839
40+ private String rootUri ;
41+
42+ private UriBuilderFactory builderFactory ;
43+
44+ @ BeforeEach
45+ void setUp () {
46+ this .rootUri = "https://example.com" ;
47+ this .builderFactory = new RootUriBuilderFactory (this .rootUri , mock (UriTemplateHandler .class ));
48+ }
49+
3950 @ Test
4051 void uriStringPrefixesRoot () throws URISyntaxException {
41- UriBuilderFactory builderFactory = new RootUriBuilderFactory ("https://example.com" ,
42- mock (UriTemplateHandler .class ));
43- UriBuilder builder = builderFactory .uriString ("/hello" );
52+ UriBuilder builder = this .builderFactory .uriString ("/hello" );
4453 assertThat (builder .build ()).isEqualTo (new URI ("https://example.com/hello" ));
4554 }
4655
4756 @ Test
4857 void uriStringWhenEmptyShouldReturnRoot () throws URISyntaxException {
49- UriBuilderFactory builderFactory = new RootUriBuilderFactory ( "https://example.com" ,
50- mock ( UriTemplateHandler . class ));
51- UriBuilder builder = builderFactory . uriString ( "" );
52- assertThat (builder . build ()) .isEqualTo (new URI ("https://example.com" ));
58+ UriBuilder builder = this . builderFactory . uriString ( "" );
59+
60+ URI builtUri = builder . build ( );
61+ assertThat (builtUri ) .isEqualTo (new URI (this . rootUri ));
5362 }
5463
5564}
You can’t perform that action at this time.
0 commit comments