Skip to content

Commit 5c1c67a

Browse files
committed
Support URI in migration runtime test
1 parent 680f39f commit 5c1c67a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/test/java/org/apache/ibatis/migration/runtime_migration/RuntimeMigrationTest.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
import java.io.File;
2323
import java.io.PrintStream;
2424
import java.math.BigDecimal;
25-
import java.net.URL;
25+
import java.net.URI;
26+
import java.net.URISyntaxException;
2627
import java.nio.file.Path;
2728
import java.sql.Connection;
2829
import java.sql.ResultSet;
@@ -249,8 +250,14 @@ protected void assertTableDoesNotExist(ConnectionProvider connectionProvider, St
249250
}
250251

251252
protected FileMigrationLoader createMigrationsLoader(String resource) {
252-
URL url = getClass().getClassLoader().getResource(resource);
253-
File scriptsDir = Path.of(url.getPath()).toFile();
253+
URI uri = null;
254+
try {
255+
uri = getClass().getClassLoader().getResource(resource).toURI();
256+
} catch (URISyntaxException e) {
257+
// Should not occur
258+
fail();
259+
}
260+
File scriptsDir = Path.of(uri).toFile();
254261
Properties properties = new Properties();
255262
properties.setProperty("changelog", "CHANGELOG");
256263
return new FileMigrationLoader(scriptsDir, "utf-8", properties);

0 commit comments

Comments
 (0)