Made test not fail in symlinked directory

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2019-08-27 13:01:34 +10:00
parent 19980ceeb5
commit d216792d23
1 changed files with 5 additions and 4 deletions

View File

@ -21,6 +21,8 @@ package org.eclipse.jetty.util;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.eclipse.jetty.util.resource.Resource;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnJre;
import org.junit.jupiter.api.condition.EnabledOnJre;
@ -160,16 +162,15 @@ public class TypeUtilTest
}
@Test
public void testGetLocationOfClass_FromMavenRepo()
public void testGetLocationOfClass_FromMavenRepo() throws Exception
{
String mavenRepoPathProperty = System.getProperty("mavenRepoPath");
assumeTrue(mavenRepoPathProperty != null);
Path mavenRepoPath = Paths.get(mavenRepoPathProperty);
String mavenRepo = mavenRepoPath.toFile().getPath().replaceAll("\\\\", "/");
// Classes from maven dependencies
assertThat(TypeUtil.getLocationOfClass(org.junit.jupiter.api.Assertions.class).toASCIIString(), containsString(mavenRepo));
Resource resource = Resource.newResource(TypeUtil.getLocationOfClass(org.junit.jupiter.api.Assertions.class).toASCIIString());
assertThat(resource.getFile().getCanonicalPath(), Matchers.startsWith(mavenRepoPath.toFile().getCanonicalPath()));
}
@Test