From 0746a2b38bdebfae2475dc2ad986e80a3e98babf Mon Sep 17 00:00:00 2001 From: Artem Krosheninnikov Date: Mon, 6 Jan 2020 17:28:39 +0300 Subject: [PATCH] [MNG-6842] do not use guava in test --- .../apache/maven/project/ProjectBuilderTest.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java b/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java index 4833b0035119..be96f14dae24 100644 --- a/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java +++ b/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java @@ -26,6 +26,8 @@ import static org.junit.Assert.assertThat; import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -39,7 +41,6 @@ import org.apache.maven.model.building.ModelSource; import org.apache.maven.shared.utils.io.FileUtils; -import com.google.common.io.Files; public class ProjectBuilderTest extends AbstractCoreMavenComponentTestCase @@ -142,19 +143,20 @@ public void testReadModifiedPoms() throws Exception { String initialValue = System.setProperty( DefaultProjectBuilder.DISABLE_GLOBAL_MODEL_CACHE_SYSTEM_PROPERTY, Boolean.toString( true ) ); // TODO a similar test should be created to test the dependency management (basically all usages // of DefaultModelBuilder.getCache() are affected by MNG-6530 - File tempDir = Files.createTempDir(); - FileUtils.copyDirectoryStructure (new File( "src/test/resources/projects/grandchild-check"), tempDir ); + + Path tempDir = Files.createTempDirectory(null); + FileUtils.copyDirectoryStructure (new File( "src/test/resources/projects/grandchild-check"), tempDir.toFile() ); try { MavenSession mavenSession = createMavenSession( null ); ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest(); configuration.setRepositorySession( mavenSession.getRepositorySession() ); org.apache.maven.project.ProjectBuilder projectBuilder = lookup( org.apache.maven.project.ProjectBuilder.class ); - File child = new File( tempDir, "child/pom.xml" ); + File child = new File( tempDir.toFile(), "child/pom.xml" ); // build project once projectBuilder.build( child, configuration ); // modify parent - File parent = new File( tempDir, "pom.xml" ); + File parent = new File( tempDir.toFile(), "pom.xml" ); String parentContent = FileUtils.fileRead( parent ); parentContent = parentContent.replaceAll( "pom", "pomaddedValue" ); @@ -173,7 +175,7 @@ public void testReadModifiedPoms() throws Exception { { System.setProperty( DefaultProjectBuilder.DISABLE_GLOBAL_MODEL_CACHE_SYSTEM_PROPERTY, initialValue ); } - FileUtils.deleteDirectory( tempDir ); + FileUtils.deleteDirectory( tempDir.toFile() ); } }