unit test must not force a maven repository path #1574

Signed-off-by: olivier lamy <olamy@webtide.com>
This commit is contained in:
olivier lamy 2017-06-05 21:29:59 +10:00
parent 80e964ef35
commit 16f441541b
2 changed files with 19 additions and 1 deletions

View File

@ -22,6 +22,19 @@
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<mavenRepoPath>${settings.localRepository}</mavenRepoPath>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>

View File

@ -24,6 +24,9 @@ import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Test;
import java.nio.file.Path;
import java.nio.file.Paths;
public class TypeUtilTest
{
@Test
@ -125,8 +128,10 @@ public class TypeUtilTest
@Test
public void testGetLocationOfClass() throws Exception
{
Path mavenRepoPath = Paths.get( System.getProperty( "mavenRepoPath" ) );
String mavenRepo = mavenRepoPath.toFile().getPath();
// Classes from maven dependencies
Assert.assertThat(TypeUtil.getLocationOfClass(Assert.class).toASCIIString(),Matchers.containsString("/repository/"));
Assert.assertThat(TypeUtil.getLocationOfClass(Assert.class).toASCIIString(),Matchers.containsString(mavenRepo));
// Class from project dependencies
Assert.assertThat(TypeUtil.getLocationOfClass(TypeUtil.class).toASCIIString(),Matchers.containsString("/classes/"));