Skip to content

Commit

Permalink
test: normalize file paths before asserting
Browse files Browse the repository at this point in the history
  • Loading branch information
bogovicj committed Apr 25, 2024
1 parent ede7058 commit 2b5e25b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/test/java/org/janelia/saalfeldlab/n5/N5URLTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Paths;

Expand Down Expand Up @@ -116,7 +118,7 @@ public void testGetRelative() throws URISyntaxException {
}

@Test
public void testContainerPath() throws URISyntaxException {
public void testContainerPath() throws URISyntaxException, IOException {

final String home = System.getProperty("user.home");
// final String posixPath = "/a/b/c/d?e#f";
Expand All @@ -126,10 +128,11 @@ public void testContainerPath() throws URISyntaxException {
// "/a/b/c/d",
// N5URI.from(posixPath).getContainerPath());

// normalize with File
final N5URI systemUri = N5URI.from(systemPath);
assertEquals(
Paths.get(home).toUri().toString(),
systemUri.getContainerPath());
Paths.get(home).toFile().getCanonicalPath(),
new File(systemUri.getContainerPath()).getCanonicalPath());

}

Expand Down

0 comments on commit 2b5e25b

Please sign in to comment.