Increasing reliability of test when run on different filesystems

This commit is contained in:
Joakim Erdfelt 2022-10-13 09:55:18 -05:00
parent 5ae363d4e1
commit 2be5a2bda4
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
1 changed files with 5 additions and 4 deletions

View File

@ -30,6 +30,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class ClassMatcherTest
@ -212,15 +213,15 @@ public class ClassMatcherTest
{
// jar from JVM classloader
URI modString = TypeUtil.getLocationOfClass(String.class);
// System.err.println(modString);
assertNotNull(modString);
// a jar from maven repo jar
URI locJunit = TypeUtil.getLocationOfClass(Test.class);
// System.err.println(locJunit);
assertNotNull(locJunit);
// class file
URI locTest = TypeUtil.getLocationOfClass(ClassMatcherTest.class);
// System.err.println(locTest);
assertNotNull(locTest);
ClassMatcher pattern = new ClassMatcher();
@ -235,7 +236,7 @@ public class ClassMatcherTest
pattern.exclude("jrt:/java.base/");
// Add jar for individual class and classes directory
pattern.exclude(locJunit.toString(), locTest.toString());
pattern.exclude(locJunit.toASCIIString(), locTest.toASCIIString());
assertThat(pattern.match(String.class), is(false));
assertThat(pattern.match(Test.class), is(false));