@@ -299,6 +299,20 @@ public void testPathJoin1() {
299299 assertEquals (ExternalRefProcessor .join ("./foo#/definitions/Foo" , "./bar#/definitions/Bar" ), "./bar#/definitions/Bar" );
300300 }
301301
302+
303+ @ Test
304+ public void testPathJoin2 () {
305+ assertEquals (RefUtils .buildUrl ("http://foo.bar.com/my/dir/file.yaml" , "../newFile.yaml" ), "http://foo.bar.com/my/newFile.yaml" );
306+ assertEquals (RefUtils .buildUrl ("http://foo.bar.com/my/dir/file.yaml" , "../../newFile.yaml" ), "http://foo.bar.com/newFile.yaml" );
307+ assertEquals (RefUtils .buildUrl ("http://foo.bar.com/my/dir/file.yaml" , "./newFile.yaml" ), "http://foo.bar.com/my/dir/newFile.yaml" );
308+ assertEquals (RefUtils .buildUrl ("http://foo.bar.com/my/dir/file.yaml" , "../second/newFile.yaml" ), "http://foo.bar.com/my/second/newFile.yaml" );
309+ assertEquals (RefUtils .buildUrl ("http://foo.bar.com/my/dir/file.yaml" , "../../otherDir/newFile.yaml" ), "http://foo.bar.com/otherDir/newFile.yaml" );
310+ assertEquals (RefUtils .buildUrl ("http://foo.bar.com/file.yaml" , "./newFile.yaml" ), "http://foo.bar.com/newFile.yaml" );
311+ assertEquals (RefUtils .buildUrl ("http://foo.bar.com/my/dir/file.yaml" , "/newFile.yaml" ), "http://foo.bar.com/newFile.yaml" );
312+ assertEquals (RefUtils .buildUrl ("http://foo.bar.com/my/dir/file.yaml" , "/my/newFile.yaml" ), "http://foo.bar.com/my/newFile.yaml" );
313+ }
314+
315+
302316 @ Test
303317 public void shouldReturnEmptyExternalPathForInternalReference () {
304318 // given
@@ -371,5 +385,6 @@ public void shouldReturnExternalPathForHttpReference() {
371385 // then
372386 assertThat (externalPath .isPresent (), is (true ));
373387 assertThat (externalPath .get (), equalTo ("http://localhost/schema.json" ));
388+
374389 }
375390}
0 commit comments