File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/main/java/io/specto/hoverfly/junit/core/config Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1010import java .net .URI ;
1111import java .net .URISyntaxException ;
1212import java .net .URL ;
13+ import java .nio .file .Path ;
1314import java .util .Optional ;
1415
1516
@@ -116,6 +117,14 @@ private void checkResourceOnClasspath(String resourceName) {
116117 private Optional <String > getTestResourcesFolderPath (String relativePath ) {
117118 ClassLoader classLoader = Thread .currentThread ().getContextClassLoader ();
118119 URL url = classLoader .getResource (relativePath );
119- return Optional .ofNullable (url ).map (URL ::getPath );
120+ return Optional .ofNullable (url ).map (this ::toPath );
121+ }
122+
123+ private String toPath (URL url ) {
124+ try {
125+ return Path .of (url .toURI ()).toString ();
126+ } catch (URISyntaxException e ) {
127+ return null ;
128+ }
120129 }
121130}
You can’t perform that action at this time.
0 commit comments