@@ -299,6 +299,20 @@ public void testPathJoin1() {
299
299
assertEquals (ExternalRefProcessor .join ("./foo#/definitions/Foo" , "./bar#/definitions/Bar" ), "./bar#/definitions/Bar" );
300
300
}
301
301
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
+
302
316
@ Test
303
317
public void shouldReturnEmptyExternalPathForInternalReference () {
304
318
// given
@@ -371,5 +385,6 @@ public void shouldReturnExternalPathForHttpReference() {
371
385
// then
372
386
assertThat (externalPath .isPresent (), is (true ));
373
387
assertThat (externalPath .get (), equalTo ("http://localhost/schema.json" ));
388
+
374
389
}
375
390
}
0 commit comments