@@ -45,17 +45,19 @@ This file is part of the iText (R) project.
45
45
import com .itextpdf .test .ExtendedITextTest ;
46
46
import com .itextpdf .test .annotations .type .UnitTest ;
47
47
48
+ import java .net .MalformedURLException ;
49
+ import java .nio .file .Paths ;
48
50
import org .junit .Assert ;
49
51
import org .junit .Ignore ;
50
52
import org .junit .Test ;
51
53
import org .junit .experimental .categories .Category ;
52
54
53
- import java .net .MalformedURLException ;
54
- import java .nio .file .Paths ;
55
-
56
55
@ Category (UnitTest .class )
57
56
public class UriResolverTest extends ExtendedITextTest {
58
57
58
+ private static final String SOURCE_FOLDER =
59
+ "./src/test/resources/com/itextpdfstyledxmlparser/resolver/resource/UriResolverTest/" ;
60
+
59
61
@ Test
60
62
public void uriResolverTest01 () throws MalformedURLException {
61
63
String absolutePathRoot = Paths .get ("" ).toAbsolutePath ().getRoot ().toUri ().toURL ().toExternalForm ();
@@ -112,6 +114,15 @@ public void uriResolverTest06() throws MalformedURLException {
112
114
testPaths (resolver , parentFolder );
113
115
}
114
116
117
+ @ Test
118
+ public void resolveAgainstBaseUriTest () throws MalformedURLException {
119
+ String baseUrl = "https://test" ;
120
+ UriResolver resolver = new UriResolver (SOURCE_FOLDER );
121
+ resolver .resolveAgainstBaseUri (baseUrl );
122
+ Assert .assertTrue (resolver .isLocalBaseUri ());
123
+ Assert .assertTrue (resolver .getBaseUri ().startsWith ("file:" ));
124
+ }
125
+
115
126
@ Test
116
127
public void uriResolverTest07 () throws MalformedURLException {
117
128
UriResolver resolver = new UriResolver ("http://itextpdf.com/itext7" );
@@ -120,6 +131,7 @@ public void uriResolverTest07() throws MalformedURLException {
120
131
Assert .assertEquals ("http://itextpdf.com/folder2/innerTest2" , resolver .resolveAgainstBaseUri ("/folder2/innerTest2" ).toExternalForm ());
121
132
Assert .assertEquals ("http://folder2.com/innerTest2" , resolver .resolveAgainstBaseUri ("//folder2.com/innerTest2" ).toExternalForm ());
122
133
}
134
+
123
135
@ Test
124
136
public void uriResolverTest07A () throws MalformedURLException {
125
137
String absolutePathRoot = Paths .get ("" ).toAbsolutePath ().getRoot ().toUri ().toURL ().toString ();
0 commit comments