You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/04/19 12:09:35 UTC

[maven-assembly-plugin] branch temporaryFolder created (now 9684b2f)

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a change to branch temporaryFolder
in repository https://gitbox.apache.org/repos/asf/maven-assembly-plugin.git.


      at 9684b2f  Replace TestFileManager with TemporaryFolder

This branch includes the following new commits:

     new 9684b2f  Replace TestFileManager with TemporaryFolder

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-assembly-plugin] 01/01: Replace TestFileManager with TemporaryFolder

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch temporaryFolder
in repository https://gitbox.apache.org/repos/asf/maven-assembly-plugin.git

commit 9684b2f5a26c8cda997da533637ea0ca4b2a92e4
Author: rfscholte <rf...@apache.org>
AuthorDate: Sun Apr 19 14:09:25 2020 +0200

    Replace TestFileManager with TemporaryFolder
---
 .../archive/DefaultAssemblyArchiverTest.java       |  21 +-
 .../archive/ManifestCreationFinalizerTest.java     |  63 +++---
 .../archiver/AssemblyProxyArchiverTest.java        |  39 ++--
 .../archive/phase/FileSetAssemblyPhaseTest.java    |  25 +--
 .../archive/phase/ModuleSetAssemblyPhaseTest.java  |  89 +++++----
 .../archive/phase/RepositoryAssemblyPhaseTest.java |  49 ++---
 .../archive/task/AddDirectoryTaskTest.java         |  45 ++---
 .../assembly/archive/task/AddFileSetsTaskTest.java |  73 ++++---
 .../MockAndControlForAddFileSetsTask.java          |   5 +-
 .../ComponentsXmlArchiverFileFilterTest.java       |  88 ++++-----
 .../assembly/io/DefaultAssemblyReaderTest.java     | 217 +++++++++------------
 .../assembly/testutils/TestFileManager.java        | 209 --------------------
 12 files changed, 324 insertions(+), 599 deletions(-)

diff --git a/src/test/java/org/apache/maven/plugins/assembly/archive/DefaultAssemblyArchiverTest.java b/src/test/java/org/apache/maven/plugins/assembly/archive/DefaultAssemblyArchiverTest.java
index 12e6757..4294b66 100644
--- a/src/test/java/org/apache/maven/plugins/assembly/archive/DefaultAssemblyArchiverTest.java
+++ b/src/test/java/org/apache/maven/plugins/assembly/archive/DefaultAssemblyArchiverTest.java
@@ -29,7 +29,6 @@ import org.apache.maven.plugins.assembly.artifact.DependencyResolver;
 import org.apache.maven.plugins.assembly.format.AssemblyFormattingException;
 import org.apache.maven.plugins.assembly.model.Assembly;
 import org.apache.maven.plugins.assembly.mojos.AbstractAssemblyMojo;
-import org.apache.maven.plugins.assembly.testutils.TestFileManager;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.DefaultPlexusContainer;
 import org.codehaus.plexus.PlexusContainer;
@@ -46,13 +45,13 @@ import org.codehaus.plexus.archiver.zip.ZipArchiver;
 import org.codehaus.plexus.interpolation.fixed.FixedStringSearchInterpolator;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.codehaus.plexus.util.FileUtils;
 import org.easymock.EasyMock;
 import org.easymock.classextension.EasyMockSupport;
-import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 import java.io.File;
 import java.io.IOException;
@@ -72,18 +71,11 @@ import static org.junit.Assert.fail;
 
 public class DefaultAssemblyArchiverTest
 {
-
-    private static final TestFileManager fileManager = new TestFileManager( "def-assy-archiver.test.", "" );
+    @Rule
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
     private PlexusContainer container;
 
-    @AfterClass
-    public static void tearDown()
-        throws Exception
-    {
-        fileManager.cleanUp();
-    }
-
     public static void setupInterpolators( AssemblerConfigurationSource configSource )
     {
         expect( configSource.getRepositoryInterpolator() ).andReturn(
@@ -153,14 +145,13 @@ public class DefaultAssemblyArchiverTest
         final AssemblerConfigurationSource configSource =
             mm.createControl().createMock( AssemblerConfigurationSource.class );
 
-        final File tempDir = fileManager.createTempDir();
-        FileUtils.deleteDirectory( tempDir );
+        final File tempDir = new File ( temporaryFolder.getRoot(), "temp" );
 
         expect( configSource.getTemporaryRootDirectory() ).andReturn( tempDir ).anyTimes();
         expect( configSource.isDryRun() ).andReturn( false ).anyTimes();
         expect( configSource.isIgnoreDirFormatExtensions() ).andReturn( false ).anyTimes();
 
-        final File outDir = fileManager.createTempDir();
+        final File outDir = temporaryFolder.newFolder( "out" );
 
         macMgr.archiver.setDestFile( new File( outDir, "full-name.zip" ) );
 
diff --git a/src/test/java/org/apache/maven/plugins/assembly/archive/ManifestCreationFinalizerTest.java b/src/test/java/org/apache/maven/plugins/assembly/archive/ManifestCreationFinalizerTest.java
index 43650e1..6e7e9e3 100644
--- a/src/test/java/org/apache/maven/plugins/assembly/archive/ManifestCreationFinalizerTest.java
+++ b/src/test/java/org/apache/maven/plugins/assembly/archive/ManifestCreationFinalizerTest.java
@@ -19,47 +19,48 @@ package org.apache.maven.plugins.assembly.archive;
  * under the License.
  */
 
-import junit.framework.TestCase;
-import org.apache.maven.archiver.MavenArchiveConfiguration;
-import org.apache.maven.model.Model;
-import org.apache.maven.plugins.assembly.testutils.TestFileManager;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.archiver.ArchiveFinalizer;
-import org.codehaus.plexus.archiver.Archiver;
-import org.codehaus.plexus.archiver.ArchiverException;
-import org.codehaus.plexus.archiver.jar.JarArchiver;
-import org.codehaus.plexus.util.IOUtil;
-import org.easymock.classextension.EasyMockSupport;
+import static org.junit.Assert.assertTrue;
 
 import java.io.BufferedReader;
 import java.io.File;
-import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.StringWriter;
 import java.net.JarURLConnection;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
 import java.util.Collections;
 
+import org.apache.maven.archiver.MavenArchiveConfiguration;
+import org.apache.maven.model.Model;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.archiver.ArchiveFinalizer;
+import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.archiver.jar.JarArchiver;
+import org.codehaus.plexus.util.IOUtil;
+import org.easymock.classextension.EasyMockSupport;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
 public class ManifestCreationFinalizerTest
-    extends TestCase
 {
 
-    private final TestFileManager fileManager = new TestFileManager( "manifest-finalizer.test.", ".jar" );
-
-    public void tearDown()
-        throws IOException
-    {
-        fileManager.cleanUp();
-    }
+    @Rule
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
+    @Test
     public void testShouldDoNothingWhenArchiveConfigIsNull()
-        throws ArchiverException
+        throws Exception
     {
         new ManifestCreationFinalizer( null, null, null ).finalizeArchiveCreation( null );
     }
 
+    @Test
     public void testShouldDoNothingWhenArchiverIsNotJarArchiver()
-        throws ArchiverException
+        throws Exception
     {
         EasyMockSupport mm = new EasyMockSupport();
 
@@ -75,24 +76,27 @@ public class ManifestCreationFinalizerTest
         mm.verifyAll();
     }
 
+    @Test
     public void testShouldAddManifestWhenArchiverIsJarArchiver()
-        throws ArchiverException, IOException
+        throws Exception
     {
         MavenProject project = new MavenProject( new Model() );
         MavenArchiveConfiguration config = new MavenArchiveConfiguration();
 
-        File tempDir = fileManager.createTempDir();
+        File tempDir = temporaryFolder.getRoot();
 
-        File manifestFile = fileManager.createFile( tempDir, "MANIFEST.MF", "Main-Class: Stuff\n" );
+        Path manifestFile = tempDir.toPath().resolve("MANIFEST.MF");
+        
+        Files.write( manifestFile, Arrays.asList( "Main-Class: Stuff\n" ), StandardCharsets.UTF_8 );
 
-        config.setManifestFile( manifestFile );
+        config.setManifestFile( manifestFile.toFile() );
 
         JarArchiver archiver = new JarArchiver();
 
         archiver.setArchiveFinalizers(
             Collections.<ArchiveFinalizer>singletonList( new ManifestCreationFinalizer( null, project, config ) ) );
 
-        File file = fileManager.createTempFile();
+        File file = temporaryFolder.newFile();
 
         archiver.setDestFile( file );
 
@@ -112,8 +116,9 @@ public class ManifestCreationFinalizerTest
         ( (JarURLConnection) resource.openConnection() ).getJarFile().close();
     }
 
+    @Test
     public void testShouldAddManifestEntriesWhenArchiverIsJarArchiver()
-        throws ArchiverException, IOException
+        throws Exception
     {
         MavenProject project = new MavenProject( new Model() );
         MavenArchiveConfiguration config = new MavenArchiveConfiguration();
@@ -128,7 +133,7 @@ public class ManifestCreationFinalizerTest
         archiver.setArchiveFinalizers(
             Collections.<ArchiveFinalizer>singletonList( new ManifestCreationFinalizer( null, project, config ) ) );
 
-        File file = fileManager.createTempFile();
+        File file = temporaryFolder.newFile();
 
         archiver.setDestFile( file );
 
diff --git a/src/test/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiverTest.java b/src/test/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiverTest.java
index b864997..ed7815f 100644
--- a/src/test/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiverTest.java
+++ b/src/test/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiverTest.java
@@ -19,7 +19,6 @@ package org.apache.maven.plugins.assembly.archive.archiver;
  * under the License.
  */
 
-import org.apache.maven.plugins.assembly.testutils.TestFileManager;
 import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.diags.TrackingArchiver;
@@ -29,16 +28,19 @@ import org.codehaus.plexus.components.io.fileselectors.FileInfo;
 import org.codehaus.plexus.components.io.fileselectors.FileSelector;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.codehaus.plexus.util.FileUtils;
 import org.easymock.EasyMock;
 import org.easymock.classextension.EasyMockSupport;
-import org.junit.AfterClass;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 import javax.annotation.Nonnull;
 import java.io.File;
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import static org.easymock.EasyMock.anyObject;
@@ -48,22 +50,16 @@ import static org.junit.Assert.assertTrue;
 
 public class AssemblyProxyArchiverTest
 {
-
-    private static final TestFileManager fileManager = new TestFileManager( "massembly-proxyArchiver", "" );
-
+    @Rule
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+    
     private static final Logger logger = new ConsoleLogger( Logger.LEVEL_DEBUG, "test" );
 
-    @AfterClass
-    public static void cleanupFiles()
-    {
-        fileManager.cleanUp();
-    }
-
     @Test( timeout = 5000 )
     public void addFileSet_SkipWhenSourceIsAssemblyWorkDir()
         throws IOException, ArchiverException
     {
-        final File sources = fileManager.createTempDir();
+        final File sources = temporaryFolder.getRoot();
 
         final File workdir = new File( sources, "workdir" );
 
@@ -85,13 +81,15 @@ public class AssemblyProxyArchiverTest
     public void addFileSet_addExcludeWhenSourceContainsAssemblyWorkDir()
         throws IOException, ArchiverException
     {
-        final File sources = fileManager.createTempDir();
+        final File sources = temporaryFolder.getRoot();
 
         final File workdir = new File( sources, "workdir" );
         workdir.mkdir();
 
-        fileManager.createFile( sources, "test-included.txt", "This is included" );
-        fileManager.createFile( workdir, "test-excluded.txt", "This is excluded" );
+        Files.write( sources.toPath().resolve( "test-included.txt" ), Arrays.asList( "This is included" ),
+                     StandardCharsets.UTF_8 );
+        Files.write( workdir.toPath().resolve( "test-excluded.txt" ), Arrays.asList( "This is excluded" ),
+                     StandardCharsets.UTF_8 );
 
         final TrackingArchiver tracker = new TrackingArchiver();
         final AssemblyProxyArchiver archiver =
@@ -137,7 +135,7 @@ public class AssemblyProxyArchiverTest
 
         archiver.setForced( true );
 
-        final File inputFile = fileManager.createTempFile();
+        final File inputFile = temporaryFolder.newFile();
 
         archiver.addFile( inputFile, "file.txt" );
 
@@ -152,7 +150,7 @@ public class AssemblyProxyArchiverTest
     {
         final Archiver delegate = new JarArchiver();
 
-        final File output = fileManager.createTempFile();
+        final File output = temporaryFolder.newFile();
 
         delegate.setDestFile( output );
 
@@ -166,9 +164,8 @@ public class AssemblyProxyArchiverTest
 
         archiver.setForced( true );
 
-        final File dir = fileManager.createTempDir();
-        FileUtils.cleanDirectory( dir );
-        fileManager.createFile( dir, "file.txt", "This is a test." );
+        final File dir = temporaryFolder.newFolder();
+        Files.write( dir.toPath().resolve( "file.txt" ), Arrays.asList( "This is a test." ), StandardCharsets.UTF_8 );
 
         archiver.addDirectory( dir );
 
diff --git a/src/test/java/org/apache/maven/plugins/assembly/archive/phase/FileSetAssemblyPhaseTest.java b/src/test/java/org/apache/maven/plugins/assembly/archive/phase/FileSetAssemblyPhaseTest.java
index 0c6551d..eb43fb5 100644
--- a/src/test/java/org/apache/maven/plugins/assembly/archive/phase/FileSetAssemblyPhaseTest.java
+++ b/src/test/java/org/apache/maven/plugins/assembly/archive/phase/FileSetAssemblyPhaseTest.java
@@ -19,7 +19,6 @@ package org.apache.maven.plugins.assembly.archive.phase;
  * under the License.
  */
 
-import junit.framework.TestCase;
 import org.apache.maven.model.Model;
 import org.apache.maven.plugins.assembly.archive.ArchiveCreationException;
 import org.apache.maven.plugins.assembly.archive.DefaultAssemblyArchiverTest;
@@ -27,41 +26,29 @@ import org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlFo
 import org.apache.maven.plugins.assembly.format.AssemblyFormattingException;
 import org.apache.maven.plugins.assembly.model.Assembly;
 import org.apache.maven.plugins.assembly.model.FileSet;
-import org.apache.maven.plugins.assembly.testutils.TestFileManager;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.logging.Logger;
 import org.easymock.EasyMock;
 import org.easymock.classextension.EasyMockSupport;
-
-import java.io.IOException;
+import org.junit.Test;
 
 import static org.easymock.EasyMock.anyObject;
 import static org.easymock.EasyMock.expect;
 
 public class FileSetAssemblyPhaseTest
-    extends TestCase
 {
-
     final EasyMockSupport mm = new EasyMockSupport();
 
-    private final TestFileManager fileManager = new TestFileManager( "file-set-assembly.test.", "" );
-
-    @Override
-    public void tearDown()
-        throws IOException
-    {
-        fileManager.cleanUp();
-    }
-
+    @Test
     public void testShouldNotFailWhenNoFileSetsSpecified()
-        throws ArchiveCreationException, AssemblyFormattingException
+        throws Exception
     {
         final Assembly assembly = new Assembly();
 
         assembly.setId( "test" );
 
         final MockAndControlForLogger macLogger = new MockAndControlForLogger();
-        final MockAndControlForAddFileSetsTask macTask = new MockAndControlForAddFileSetsTask( mm, fileManager );
+        final MockAndControlForAddFileSetsTask macTask = new MockAndControlForAddFileSetsTask( mm );
 
         mm.replayAll();
 
@@ -70,7 +57,7 @@ public class FileSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
-    public void testShouldAddOneFileSet()
+    @Test public void testShouldAddOneFileSet()
         throws ArchiveCreationException, AssemblyFormattingException
     {
         final Assembly assembly = new Assembly();
@@ -87,7 +74,7 @@ public class FileSetAssemblyPhaseTest
         assembly.addFileSet( fs );
 
         final MockAndControlForLogger macLogger = new MockAndControlForLogger();
-        final MockAndControlForAddFileSetsTask macTask = new MockAndControlForAddFileSetsTask( mm, fileManager );
+        final MockAndControlForAddFileSetsTask macTask = new MockAndControlForAddFileSetsTask( mm );
 
         macTask.expectGetArchiveBaseDirectory();
 
diff --git a/src/test/java/org/apache/maven/plugins/assembly/archive/phase/ModuleSetAssemblyPhaseTest.java b/src/test/java/org/apache/maven/plugins/assembly/archive/phase/ModuleSetAssemblyPhaseTest.java
index 20decc1..8e4b90d 100644
--- a/src/test/java/org/apache/maven/plugins/assembly/archive/phase/ModuleSetAssemblyPhaseTest.java
+++ b/src/test/java/org/apache/maven/plugins/assembly/archive/phase/ModuleSetAssemblyPhaseTest.java
@@ -19,8 +19,6 @@ package org.apache.maven.plugins.assembly.archive.phase;
  * under the License.
  */
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
 import org.apache.maven.model.Model;
 import org.apache.maven.plugins.assembly.InvalidAssemblerConfigurationException;
 import org.apache.maven.plugins.assembly.archive.ArchiveCreationException;
@@ -37,7 +35,6 @@ import org.apache.maven.plugins.assembly.model.FileSet;
 import org.apache.maven.plugins.assembly.model.ModuleBinaries;
 import org.apache.maven.plugins.assembly.model.ModuleSet;
 import org.apache.maven.plugins.assembly.model.ModuleSources;
-import org.apache.maven.plugins.assembly.testutils.TestFileManager;
 import org.apache.maven.plugins.assembly.utils.TypeConversionUtils;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuilder;
@@ -45,6 +42,9 @@ import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.EasyMockSupport;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 import java.io.File;
 import java.io.IOException;
@@ -56,23 +56,19 @@ import java.util.List;
 import java.util.Set;
 
 import static java.util.Collections.singleton;
-
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 public class ModuleSetAssemblyPhaseTest
-    extends TestCase
 {
-
-    private final TestFileManager fileManager = new TestFileManager( "module-set-phase.test.", "" );
+    @Rule
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
     private final Logger logger = new ConsoleLogger( Logger.LEVEL_INFO, "test" );
 
-    @Override
-    public void tearDown()
-        throws IOException
-    {
-        fileManager.cleanUp();
-    }
-
+    @Test
     public void testIsDeprecatedModuleSourcesConfigPresent_ShouldCatchOutputDir()
     {
         final ModuleSources sources = new ModuleSources();
@@ -83,6 +79,7 @@ public class ModuleSetAssemblyPhaseTest
         assertTrue( phase.isDeprecatedModuleSourcesConfigPresent( sources ) );
     }
 
+    @Test
     public void testIsDeprecatedModuleSourcesConfigPresent_ShouldCatchInclude()
     {
         final ModuleSources sources = new ModuleSources();
@@ -93,6 +90,7 @@ public class ModuleSetAssemblyPhaseTest
         assertTrue( phase.isDeprecatedModuleSourcesConfigPresent( sources ) );
     }
 
+    @Test
     public void testIsDeprecatedModuleSourcesConfigPresent_ShouldCatchExclude()
     {
         final ModuleSources sources = new ModuleSources();
@@ -103,6 +101,7 @@ public class ModuleSetAssemblyPhaseTest
         assertTrue( phase.isDeprecatedModuleSourcesConfigPresent( sources ) );
     }
 
+    @Test
     public void testIsDeprecatedModuleSourcesConfigPresent_ShouldNotCatchFileMode()
     {
         final ModuleSources sources = new ModuleSources();
@@ -113,6 +112,7 @@ public class ModuleSetAssemblyPhaseTest
         assertFalse( phase.isDeprecatedModuleSourcesConfigPresent( sources ) );
     }
 
+    @Test
     public void testIsDeprecatedModuleSourcesConfigPresent_ShouldNotCatchDirMode()
     {
         final ModuleSources sources = new ModuleSources();
@@ -123,6 +123,7 @@ public class ModuleSetAssemblyPhaseTest
         assertFalse( phase.isDeprecatedModuleSourcesConfigPresent( sources ) );
     }
 
+    @Test
     public void testCreateFileSet_ShouldUseModuleDirOnlyWhenOutDirIsNull()
         throws AssemblyFormattingException
     {
@@ -142,7 +143,7 @@ public class ModuleSetAssemblyPhaseTest
         final ModuleSources sources = new ModuleSources();
         sources.setIncludeModuleDirectory( true );
 
-        final File basedir = fileManager.createTempDir();
+        final File basedir = temporaryFolder.getRoot();
 
         final MavenProject artifactProject = new MavenProject( new Model() );
 
@@ -166,6 +167,7 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testCreateFileSet_ShouldPrependModuleDirWhenOutDirIsProvided()
         throws AssemblyFormattingException
     {
@@ -188,7 +190,7 @@ public class ModuleSetAssemblyPhaseTest
 
         final MavenProject artifactProject = new MavenProject( new Model() );
 
-        final File basedir = fileManager.createTempDir();
+        final File basedir = temporaryFolder.getRoot();
 
         artifactProject.setFile( new File( basedir, "pom.xml" ) );
 
@@ -209,6 +211,7 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testCreateFileSet_ShouldAddExcludesForSubModulesWhenExcludeSubModDirsIsTrue()
         throws AssemblyFormattingException
     {
@@ -230,7 +233,7 @@ public class ModuleSetAssemblyPhaseTest
 
         final MavenProject project = new MavenProject( model );
 
-        final File basedir = fileManager.createTempDir();
+        final File basedir = temporaryFolder.getRoot();
 
         project.setFile( new File( basedir, "pom.xml" ) );
 
@@ -251,6 +254,7 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testExecute_ShouldSkipIfNoModuleSetsFound()
         throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException,
         DependencyResolutionException
@@ -261,6 +265,7 @@ public class ModuleSetAssemblyPhaseTest
         createPhase( null, null ).execute( assembly, null, null );
     }
 
+    @Test
     public void testExecute_ShouldAddOneModuleSetWithOneModuleInIt()
         throws ArchiveCreationException, AssemblyFormattingException, IOException,
         InvalidAssemblerConfigurationException, DependencyResolutionException
@@ -320,6 +325,7 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testAddModuleBinaries_ShouldReturnImmediatelyWhenBinariesIsNull()
         throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException,
         DependencyResolutionException
@@ -327,6 +333,7 @@ public class ModuleSetAssemblyPhaseTest
         createPhase( null, null ).addModuleBinaries( null, null, null, null, null, null );
     }
 
+    @Test
     public void testAddModuleBinaries_ShouldFilterPomModule()
         throws ArchiveCreationException, AssemblyFormattingException, IOException,
         InvalidAssemblerConfigurationException, DependencyResolutionException
@@ -360,6 +367,7 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testAddModuleBinaries_ShouldAddOneModuleAttachmentArtifactAndNoDeps()
         throws ArchiveCreationException, AssemblyFormattingException, IOException,
         InvalidAssemblerConfigurationException, DependencyResolutionException
@@ -374,8 +382,9 @@ public class ModuleSetAssemblyPhaseTest
         macTask.expectGetFinalName( "final-name" );
         macTask.expectGetDestFile( new File( "junk" ) );
         macTask.expectGetMode( 0222, 0222 );
-        macTask.expectAddFile( artifactFile, "out/artifact", TypeConversionUtils.modeToInt( "777", new ConsoleLogger(
-            Logger.LEVEL_DEBUG, "test" ) ) );
+        macTask.expectAddFile( artifactFile, "out/artifact",
+                               TypeConversionUtils.modeToInt( "777",
+                                                              new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) ) );
 
         final ModuleBinaries binaries = new ModuleBinaries();
 
@@ -405,6 +414,7 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testAddModuleBinaries_ShouldFailWhenOneModuleDoesntHaveAttachmentWithMatchingClassifier()
         throws ArchiveCreationException, AssemblyFormattingException, IOException, DependencyResolutionException
     {
@@ -447,6 +457,7 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testAddModuleBinaries_ShouldAddOneModuleArtifactAndNoDeps()
         throws ArchiveCreationException, AssemblyFormattingException, IOException,
         InvalidAssemblerConfigurationException, DependencyResolutionException
@@ -460,8 +471,9 @@ public class ModuleSetAssemblyPhaseTest
 
         macTask.expectGetFinalName( "final-name" );
         macTask.expectGetDestFile( new File( "junk" ) );
-        macTask.expectAddFile( artifactFile, "out/artifact", TypeConversionUtils.modeToInt( "777", new ConsoleLogger(
-            Logger.LEVEL_DEBUG, "test" ) ) );
+        macTask.expectAddFile( artifactFile, "out/artifact",
+                               TypeConversionUtils.modeToInt( "777",
+                                                              new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) ) );
         macTask.expectGetMode( 0222, 0222 );
 
         final ModuleBinaries binaries = new ModuleBinaries();
@@ -491,7 +503,7 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
-
+    @Test
     public void testAddModuleArtifact_ShouldThrowExceptionWhenArtifactFileIsNull()
         throws AssemblyFormattingException, IOException
     {
@@ -504,8 +516,8 @@ public class ModuleSetAssemblyPhaseTest
 
         try
         {
-            createPhase( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ), null ).addModuleArtifact(
-                artifactMock.getArtifact(), null, null, null, null );
+            createPhase( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ),
+                         null ).addModuleArtifact( artifactMock.getArtifact(), null, null, null, null );
 
             fail( "Expected ArchiveCreationException since artifact file is null." );
         }
@@ -517,6 +529,7 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testAddModuleArtifact_ShouldAddOneArtifact()
         throws AssemblyFormattingException, IOException, ArchiveCreationException
     {
@@ -534,8 +547,9 @@ public class ModuleSetAssemblyPhaseTest
         macTask.expectGetDestFile( new File( "junk" ) );
         macTask.expectGetMode( 0222, 0222 );
 
-        macTask.expectAddFile( artifactFile, "out/artifact", TypeConversionUtils.modeToInt( "777", new ConsoleLogger(
-            Logger.LEVEL_DEBUG, "test" ) ) );
+        macTask.expectAddFile( artifactFile, "out/artifact",
+                               TypeConversionUtils.modeToInt( "777",
+                                                              new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) ) );
 
         final ModuleBinaries binaries = new ModuleBinaries();
         binaries.setOutputDirectory( "out" );
@@ -546,12 +560,14 @@ public class ModuleSetAssemblyPhaseTest
 
         mm.replayAll();
 
-        createPhase( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ), null ).addModuleArtifact(
-            artifactMock.getArtifact(), project, macTask.archiver, macTask.configSource, binaries );
+        createPhase( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ),
+                     null ).addModuleArtifact( artifactMock.getArtifact(), project, macTask.archiver,
+                                               macTask.configSource, binaries );
 
         mm.verifyAll();
     }
 
+    @Test
     public void testAddModuleSourceFileSets_ShouldReturnImmediatelyIfSourcesIsNull()
         throws ArchiveCreationException, AssemblyFormattingException
     {
@@ -565,12 +581,13 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testAddModuleSourceFileSets_ShouldAddOneSourceDirectory()
         throws ArchiveCreationException, AssemblyFormattingException
     {
         final EasyMockSupport mm = new EasyMockSupport();
 
-        final MockAndControlForAddFileSetsTask macTask = new MockAndControlForAddFileSetsTask( mm, fileManager );
+        final MockAndControlForAddFileSetsTask macTask = new MockAndControlForAddFileSetsTask( mm );
 
         final MavenProject project = createProject( "group", "artifact", "version", null );
 
@@ -609,6 +626,7 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testGetModuleProjects_ShouldReturnNothingWhenReactorContainsOnlyCurrentProject()
         throws ArchiveCreationException
     {
@@ -636,6 +654,7 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testGetModuleProjects_ShouldReturnNothingWhenReactorContainsTwoSiblingProjects()
         throws ArchiveCreationException
     {
@@ -667,6 +686,7 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testGetModuleProjects_ShouldReturnModuleOfCurrentProject()
         throws ArchiveCreationException
     {
@@ -702,6 +722,7 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testGetModuleProjects_ShouldReturnDescendentModulesOfCurrentProject()
         throws ArchiveCreationException
     {
@@ -741,6 +762,7 @@ public class ModuleSetAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testGetModuleProjects_ShouldExcludeModuleAndDescendentsTransitively()
         throws ArchiveCreationException
     {
@@ -783,9 +805,8 @@ public class ModuleSetAssemblyPhaseTest
     private ArtifactMock addArtifact( final MavenProject project, final EasyMockSupport mm,
                                       final boolean expectDepTrailCheck )
     {
-        final ArtifactMock macArtifact =
-            new ArtifactMock( mm, project.getGroupId(), project.getArtifactId(), project.getVersion(),
-                              project.getPackaging(), false );
+        final ArtifactMock macArtifact = new ArtifactMock( mm, project.getGroupId(), project.getArtifactId(),
+                                                           project.getVersion(), project.getPackaging(), false );
 
         if ( expectDepTrailCheck )
         {
@@ -843,7 +864,7 @@ public class ModuleSetAssemblyPhaseTest
 
         if ( failed )
         {
-            Assert.fail( "See system output for more information." );
+            fail( "See system output for more information." );
         }
     }
 
@@ -860,7 +881,7 @@ public class ModuleSetAssemblyPhaseTest
         File pomFile;
         if ( parentProject == null )
         {
-            final File basedir = fileManager.createTempDir();
+            final File basedir = temporaryFolder.getRoot();
             pomFile = new File( basedir, "pom.xml" );
         }
         else
diff --git a/src/test/java/org/apache/maven/plugins/assembly/archive/phase/RepositoryAssemblyPhaseTest.java b/src/test/java/org/apache/maven/plugins/assembly/archive/phase/RepositoryAssemblyPhaseTest.java
index 5cc10b3..3f38c97 100644
--- a/src/test/java/org/apache/maven/plugins/assembly/archive/phase/RepositoryAssemblyPhaseTest.java
+++ b/src/test/java/org/apache/maven/plugins/assembly/archive/phase/RepositoryAssemblyPhaseTest.java
@@ -19,20 +19,20 @@ package org.apache.maven.plugins.assembly.archive.phase;
  * under the License.
  */
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.expect;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+
 import org.apache.maven.model.Model;
 import org.apache.maven.plugins.assembly.AssemblerConfigurationSource;
-import org.apache.maven.plugins.assembly.InvalidAssemblerConfigurationException;
-import org.apache.maven.plugins.assembly.archive.ArchiveCreationException;
-import org.apache.maven.plugins.assembly.format.AssemblyFormattingException;
 import org.apache.maven.plugins.assembly.model.Assembly;
 import org.apache.maven.plugins.assembly.model.Repository;
 import org.apache.maven.plugins.assembly.repository.RepositoryAssembler;
 import org.apache.maven.plugins.assembly.repository.RepositoryAssemblyException;
 import org.apache.maven.plugins.assembly.repository.RepositoryBuilderConfigSource;
 import org.apache.maven.plugins.assembly.repository.model.RepositoryInfo;
-import org.apache.maven.plugins.assembly.testutils.TestFileManager;
 import org.apache.maven.plugins.assembly.utils.TypeConversionUtils;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.archiver.Archiver;
@@ -44,28 +44,18 @@ import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.EasyMockSupport;
-
-import java.io.File;
-import java.io.IOException;
-
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.expect;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 public class RepositoryAssemblyPhaseTest
-    extends TestCase
 {
-
-    private final TestFileManager fileManager = new TestFileManager( "repository-phase.test.", "" );
-
-    @Override
-    public void tearDown()
-        throws IOException
-    {
-        fileManager.cleanUp();
-    }
-
+    @Rule
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+    
+    @Test
     public void testExecute_ShouldNotIncludeRepositoryIfNonSpecifiedInAssembly()
-        throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException
+        throws Exception
     {
         final EasyMockSupport mm = new EasyMockSupport();
 
@@ -73,7 +63,7 @@ public class RepositoryAssemblyPhaseTest
         final MockAndControlForArchiver macArchiver = new MockAndControlForArchiver( mm );
         final MockAndControlForConfigSource macCS = new MockAndControlForConfigSource( mm );
 
-        final File tempRoot = fileManager.createTempDir();
+        final File tempRoot = temporaryFolder.getRoot();
 
         macCS.expectGetTemporaryRootDirectory( tempRoot );
 
@@ -91,8 +81,9 @@ public class RepositoryAssemblyPhaseTest
         mm.verifyAll();
     }
 
+    @Test
     public void testExecute_ShouldIncludeOneRepository()
-        throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException
+        throws Exception
     {
         final EasyMockSupport mm = new EasyMockSupport();
 
@@ -100,7 +91,7 @@ public class RepositoryAssemblyPhaseTest
         final MockAndControlForArchiver macArchiver = new MockAndControlForArchiver( mm );
         final MockAndControlForConfigSource macCS = new MockAndControlForConfigSource( mm );
 
-        final File tempRoot = fileManager.createTempDir();
+        final File tempRoot = temporaryFolder.getRoot();
 
         macCS.expectGetTemporaryRootDirectory( tempRoot );
         macCS.expectGetProject( new MavenProject( new Model() ) );
@@ -171,7 +162,7 @@ public class RepositoryAssemblyPhaseTest
             }
             catch ( final ArchiverException e )
             {
-                Assert.fail( "Should never happen." );
+                fail( "Should never happen." );
             }
 
             EasyMock.expectLastCall().atLeastOnce();
@@ -269,7 +260,7 @@ public class RepositoryAssemblyPhaseTest
             }
             catch ( final RepositoryAssemblyException e )
             {
-                Assert.fail( "Should never happen" );
+                fail( "Should never happen" );
             }
 
         }
diff --git a/src/test/java/org/apache/maven/plugins/assembly/archive/task/AddDirectoryTaskTest.java b/src/test/java/org/apache/maven/plugins/assembly/archive/task/AddDirectoryTaskTest.java
index c8439cf..2a534e6 100644
--- a/src/test/java/org/apache/maven/plugins/assembly/archive/task/AddDirectoryTaskTest.java
+++ b/src/test/java/org/apache/maven/plugins/assembly/archive/task/AddDirectoryTaskTest.java
@@ -19,51 +19,44 @@ package org.apache.maven.plugins.assembly.archive.task;
  * under the License.
  */
 
-import junit.framework.TestCase;
-import org.apache.maven.plugins.assembly.archive.ArchiveCreationException;
-import org.apache.maven.plugins.assembly.testutils.TestFileManager;
 import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.FileSet;
 import org.easymock.classextension.EasyMockSupport;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.Collections;
 
 import static org.easymock.EasyMock.anyObject;
 import static org.easymock.EasyMock.expect;
+import static org.junit.Assert.fail;
 
 public class AddDirectoryTaskTest
-    extends TestCase
 {
+    @Rule
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
     private EasyMockSupport mockManager;
 
-    private TestFileManager fileManager;
-
     private Archiver archiver;
 
-
+    @Before
     public void setUp()
     {
-        fileManager = new TestFileManager( "ArchiveAssemblyUtils.test.", "" );
-
         mockManager = new EasyMockSupport();
 
         archiver = mockManager.createMock( Archiver.class );
     }
 
-    public void tearDown()
-        throws IOException
-    {
-        fileManager.cleanUp();
-    }
-
+    @Test
     public void testAddDirectory_ShouldNotAddDirectoryIfNonExistent()
-        throws ArchiveCreationException
+        throws Exception
     {
-        File dir = new File( System.getProperty( "java.io.tmpdir" ), "non-existent." + System.currentTimeMillis() );
+        File dir = new File( temporaryFolder.getRoot(), "non-existent." + System.currentTimeMillis() );
 
         configureModeExpectations( -1, -1, -1, -1, false );
 
@@ -76,10 +69,12 @@ public class AddDirectoryTaskTest
         mockManager.verifyAll();
     }
 
+    @Test
+
     public void testAddDirectory_ShouldAddDirectory()
-        throws ArchiveCreationException
+        throws Exception
     {
-        File dir = fileManager.createTempDir();
+        File dir = temporaryFolder.getRoot();
 
         try
         {
@@ -103,10 +98,11 @@ public class AddDirectoryTaskTest
         mockManager.verifyAll();
     }
 
+    @Test
     public void testAddDirectory_ShouldAddDirectoryWithDirMode()
-        throws ArchiveCreationException
+        throws Exception
     {
-        File dir = fileManager.createTempDir();
+        File dir = temporaryFolder.getRoot();
 
         try
         {
@@ -135,10 +131,11 @@ public class AddDirectoryTaskTest
         mockManager.verifyAll();
     }
 
+    @Test
     public void testAddDirectory_ShouldAddDirectoryWithIncludesAndExcludes()
-        throws ArchiveCreationException
+        throws Exception
     {
-        File dir = fileManager.createTempDir();
+        File dir = temporaryFolder.getRoot();
 
         try
         {
diff --git a/src/test/java/org/apache/maven/plugins/assembly/archive/task/AddFileSetsTaskTest.java b/src/test/java/org/apache/maven/plugins/assembly/archive/task/AddFileSetsTaskTest.java
index 106c03f..98d861f 100644
--- a/src/test/java/org/apache/maven/plugins/assembly/archive/task/AddFileSetsTaskTest.java
+++ b/src/test/java/org/apache/maven/plugins/assembly/archive/task/AddFileSetsTaskTest.java
@@ -19,56 +19,49 @@ package org.apache.maven.plugins.assembly.archive.task;
  * under the License.
  */
 
-import junit.framework.TestCase;
 import org.apache.maven.model.Model;
 import org.apache.maven.plugins.assembly.archive.ArchiveCreationException;
 import org.apache.maven.plugins.assembly.archive.DefaultAssemblyArchiverTest;
 import org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddFileSetsTask;
-import org.apache.maven.plugins.assembly.format.AssemblyFormattingException;
 import org.apache.maven.plugins.assembly.model.FileSet;
-import org.apache.maven.plugins.assembly.testutils.TestFileManager;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
 import org.easymock.classextension.EasyMockSupport;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.ArrayList;
 
 import static org.easymock.EasyMock.expect;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 public class AddFileSetsTaskTest
-    extends TestCase
 {
+    @Rule
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
     private EasyMockSupport mockManager;
 
-    private TestFileManager fileManager;
-
     private MockAndControlForAddFileSetsTask macTask;
 
-    @Override
+    @Before
     public void setUp()
     {
         mockManager = new EasyMockSupport();
 
-        fileManager = new TestFileManager( "add-fileset.test.", "" );
-
-        macTask = new MockAndControlForAddFileSetsTask( mockManager, fileManager );
-    }
-
-    @Override
-    public void tearDown()
-        throws IOException
-    {
-        fileManager.cleanUp();
+        macTask = new MockAndControlForAddFileSetsTask( mockManager );
     }
 
+    @Test
     public void testGetFileSetDirectory_ShouldReturnAbsoluteSourceDir()
-        throws ArchiveCreationException, AssemblyFormattingException
+        throws Exception
     {
-        final File dir = fileManager.createTempDir();
+        final File dir = temporaryFolder.newFolder();
 
         final FileSet fs = new FileSet();
 
@@ -79,10 +72,11 @@ public class AddFileSetsTaskTest
         assertEquals( dir.getAbsolutePath(), result.getAbsolutePath() );
     }
 
+    @Test
     public void testGetFileSetDirectory_ShouldReturnBasedir()
-        throws ArchiveCreationException, AssemblyFormattingException
+        throws Exception
     {
-        final File dir = fileManager.createTempDir();
+        final File dir = temporaryFolder.newFolder();
 
         final FileSet fs = new FileSet();
 
@@ -91,10 +85,11 @@ public class AddFileSetsTaskTest
         assertEquals( dir.getAbsolutePath(), result.getAbsolutePath() );
     }
 
+    @Test
     public void testGetFileSetDirectory_ShouldReturnDirFromBasedirAndSourceDir()
-        throws ArchiveCreationException, AssemblyFormattingException
+        throws Exception
     {
-        final File dir = fileManager.createTempDir();
+        final File dir = temporaryFolder.newFolder();
 
         final String srcPath = "source";
 
@@ -109,10 +104,11 @@ public class AddFileSetsTaskTest
         assertEquals( srcDir.getAbsolutePath(), result.getAbsolutePath() );
     }
 
+    @Test
     public void testGetFileSetDirectory_ShouldReturnDirFromArchiveBasedirAndSourceDir()
-        throws ArchiveCreationException, AssemblyFormattingException
+        throws Exception
     {
-        final File dir = fileManager.createTempDir();
+        final File dir = temporaryFolder.newFolder();
 
         final String srcPath = "source";
 
@@ -127,8 +123,9 @@ public class AddFileSetsTaskTest
         assertEquals( srcDir.getAbsolutePath(), result.getAbsolutePath() );
     }
 
+    @Test
     public void testAddFileSet_ShouldAddDirectory()
-        throws ArchiveCreationException, AssemblyFormattingException
+        throws Exception
     {
         final FileSet fs = new FileSet();
 
@@ -162,8 +159,9 @@ public class AddFileSetsTaskTest
         mockManager.verifyAll();
     }
 
+    @Test
     public void testAddFileSet_ShouldAddDirectoryUsingSourceDirNameForDestDir()
-        throws ArchiveCreationException, AssemblyFormattingException
+        throws Exception
     {
         final FileSet fs = new FileSet();
 
@@ -171,7 +169,7 @@ public class AddFileSetsTaskTest
 
         fs.setDirectory( dirname );
 
-        final File archiveBaseDir = fileManager.createTempDir();
+        final File archiveBaseDir = temporaryFolder.newFolder();
 
         // ensure this exists, so the directory addition will proceed.
         final File srcDir = new File( archiveBaseDir, dirname );
@@ -198,8 +196,9 @@ public class AddFileSetsTaskTest
         mockManager.verifyAll();
     }
 
+    @Test
     public void testAddFileSet_ShouldNotAddDirectoryWhenSourceDirNonExistent()
-        throws ArchiveCreationException, AssemblyFormattingException
+        throws Exception
     {
         final FileSet fs = new FileSet();
 
@@ -207,7 +206,7 @@ public class AddFileSetsTaskTest
 
         fs.setDirectory( dirname );
 
-        final File archiveBaseDir = fileManager.createTempDir();
+        final File archiveBaseDir = temporaryFolder.newFolder();
 
         macTask.expectGetFinalName( "finalName" );
 
@@ -231,11 +230,11 @@ public class AddFileSetsTaskTest
         mockManager.verifyAll();
     }
 
+    @Test
     public void testExecute_ShouldThrowExceptionIfArchiveBasedirProvidedIsNonExistent()
-        throws AssemblyFormattingException
+        throws Exception
     {
-        macTask.archiveBaseDir.delete();
-
+        macTask.archiveBaseDir = new File( temporaryFolder.getRoot(), "archive");
         macTask.expectGetArchiveBaseDirectory();
 
         mockManager.replayAll();
@@ -256,11 +255,11 @@ public class AddFileSetsTaskTest
         mockManager.verifyAll();
     }
 
+    @Test
     public void testExecute_ShouldThrowExceptionIfArchiveBasedirProvidedIsNotADirectory()
-        throws AssemblyFormattingException, IOException
+        throws Exception
     {
-
-        macTask.archiveBaseDir = fileManager.createTempFile();
+        macTask.archiveBaseDir = temporaryFolder.newFile();
         macTask.expectGetArchiveBaseDirectory();
 
         mockManager.replayAll();
diff --git a/src/test/java/org/apache/maven/plugins/assembly/archive/task/testutils/MockAndControlForAddFileSetsTask.java b/src/test/java/org/apache/maven/plugins/assembly/archive/task/testutils/MockAndControlForAddFileSetsTask.java
index cc5fd60..3d4b573 100644
--- a/src/test/java/org/apache/maven/plugins/assembly/archive/task/testutils/MockAndControlForAddFileSetsTask.java
+++ b/src/test/java/org/apache/maven/plugins/assembly/archive/task/testutils/MockAndControlForAddFileSetsTask.java
@@ -21,7 +21,6 @@ package org.apache.maven.plugins.assembly.archive.task.testutils;
 
 import junit.framework.Assert;
 import org.apache.maven.plugins.assembly.AssemblerConfigurationSource;
-import org.apache.maven.plugins.assembly.testutils.TestFileManager;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.ArchiverException;
@@ -39,16 +38,14 @@ public class MockAndControlForAddFileSetsTask
 
     public final AssemblerConfigurationSource configSource;
 
-
     public final Archiver archiver;
 
     public File archiveBaseDir;
 
-    public MockAndControlForAddFileSetsTask( EasyMockSupport mockManager, TestFileManager fileManager )
+    public MockAndControlForAddFileSetsTask( EasyMockSupport mockManager )
     {
         configSource = mockManager.createMock( AssemblerConfigurationSource.class );
         archiver = mockManager.createMock( Archiver.class );
-        archiveBaseDir = fileManager.createTempDir();
 
         expect( configSource.getMavenSession() ).andReturn( null ).anyTimes();
     }
diff --git a/src/test/java/org/apache/maven/plugins/assembly/filter/ComponentsXmlArchiverFileFilterTest.java b/src/test/java/org/apache/maven/plugins/assembly/filter/ComponentsXmlArchiverFileFilterTest.java
index df2718a..26954ce 100644
--- a/src/test/java/org/apache/maven/plugins/assembly/filter/ComponentsXmlArchiverFileFilterTest.java
+++ b/src/test/java/org/apache/maven/plugins/assembly/filter/ComponentsXmlArchiverFileFilterTest.java
@@ -19,9 +19,6 @@ package org.apache.maven.plugins.assembly.filter;
  * under the License.
  */
 
-import junit.framework.TestCase;
-
-import org.apache.maven.plugins.assembly.testutils.TestFileManager;
 import org.codehaus.plexus.archiver.ArchiveEntry;
 import org.codehaus.plexus.archiver.ArchiveFinalizer;
 import org.codehaus.plexus.archiver.ArchivedFileSet;
@@ -33,24 +30,30 @@ import org.codehaus.plexus.archiver.diags.NoOpArchiver;
 import org.codehaus.plexus.archiver.zip.ZipArchiver;
 import org.codehaus.plexus.components.io.resources.PlexusIoResource;
 import org.codehaus.plexus.components.io.resources.PlexusIoResourceCollection;
-import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 import org.jdom.Document;
-import org.jdom.JDOMException;
 import org.jdom.Text;
 import org.jdom.input.SAXBuilder;
 import org.jdom.xpath.XPath;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 import javax.annotation.Nonnull;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
 import java.io.File;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.Reader;
 import java.io.StringReader;
 import java.io.StringWriter;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.LinkedHashMap;
@@ -61,27 +64,22 @@ import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
 public class ComponentsXmlArchiverFileFilterTest
-    extends TestCase
 {
-    private final TestFileManager fileManager = new TestFileManager( "componentsXmlArchiverFileFilter.test", ".zip" );
+//    private final TestFileManager fileManager = new TestFileManager( "componentsXmlArchiverFileFilter.test", ".zip" );
+    @Rule
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
     private ComponentsXmlArchiverFileFilter filter;
 
-    @Override
+    @Before
     public void setUp()
     {
         filter = new ComponentsXmlArchiverFileFilter();
     }
 
-    @Override
-    public void tearDown()
-        throws IOException
-    {
-        fileManager.cleanUp();
-    }
-
+    @Test
     public void testAddComponentsXml_ShouldAddComponentWithoutRoleHint()
-        throws IOException, XmlPullParserException
+        throws Exception
     {
         final Reader reader = writeComponentsXml(
             Collections.singletonList( new ComponentDef( "role", null, "org.apache.maven.Impl" ) ) );
@@ -97,8 +95,9 @@ public class ComponentsXmlArchiverFileFilterTest
         assertEquals( "org.apache.maven.Impl", componentDom.getChild( "implementation" ).getValue() );
     }
 
+    @Test
     public void testAddComponentsXml_ShouldAddComponentWithRoleHint()
-        throws IOException, XmlPullParserException
+        throws Exception
     {
         final Reader reader = writeComponentsXml(
             Collections.singletonList( new ComponentDef( "role", "hint", "org.apache.maven.Impl" ) ) );
@@ -114,8 +113,9 @@ public class ComponentsXmlArchiverFileFilterTest
         assertEquals( "org.apache.maven.Impl", componentDom.getChild( "implementation" ).getValue() );
     }
 
+    @Test
     public void testAddComponentsXml_ShouldAddTwoComponentsWithRoleHints()
-        throws IOException, XmlPullParserException
+        throws Exception
     {
         final List<ComponentDef> defs = new ArrayList<>();
 
@@ -141,8 +141,9 @@ public class ComponentsXmlArchiverFileFilterTest
         assertEquals( "org.apache.maven.Impl2", componentDom.getChild( "implementation" ).getValue() );
     }
 
+    @Test
     public void testAddToArchive_ShouldWriteComponentWithoutHintToFile()
-        throws IOException, ArchiverException, JDOMException
+        throws Exception
     {
         final Xpp3Dom dom = createComponentDom( new ComponentDef( "role", null, "impl" ) );
 
@@ -168,8 +169,9 @@ public class ComponentsXmlArchiverFileFilterTest
         assertEquals( "impl", ( (Text) implementation.selectSingleNode( doc ) ).getText() );
     }
 
+    @Test
     public void testAddToArchive_ShouldWriteComponentWithHintToFile()
-        throws IOException, ArchiverException, JDOMException
+        throws Exception
     {
         final Xpp3Dom dom = createComponentDom( new ComponentDef( "role", "hint", "impl" ) );
 
@@ -195,8 +197,9 @@ public class ComponentsXmlArchiverFileFilterTest
         assertEquals( "impl", ( (Text) implementation.selectSingleNode( doc ) ).getText() );
     }
 
+    @Test
     public void testAddToArchive_ShouldWriteTwoComponentToFile()
-        throws IOException, ArchiverException, JDOMException
+        throws Exception
     {
         filter.components = new LinkedHashMap<>();
 
@@ -236,8 +239,9 @@ public class ComponentsXmlArchiverFileFilterTest
 
     }
 
+    @Test
     public void testAddToArchive_ShouldWriteTwoComponentToArchivedFile()
-        throws IOException, ArchiverException, JDOMException
+        throws Exception
     {
         filter.components = new LinkedHashMap<>();
 
@@ -251,50 +255,24 @@ public class ComponentsXmlArchiverFileFilterTest
 
         final ZipArchiver archiver = new ZipArchiver();
 
-        final File archiveFile = fileManager.createTempFile();
+        final File archiveFile = temporaryFolder.newFile( "archive" );
 
         archiver.setDestFile( archiveFile );
 
-        final File descriptorFile = fileManager.createTempFile();
+        final File descriptorFile = new File( temporaryFolder.getRoot(), "descriptor.xml" );
 
         archiver.setArchiveFinalizers( Collections.<ArchiveFinalizer>singletonList( filter ) );
 
         archiver.createArchive();
-
-        ZipFile zf = null;
-        FileOutputStream out = null;
-        try
+        
+        try ( ZipFile zf = new ZipFile( archiveFile ) )
         {
-            zf = new ZipFile( archiveFile );
-
             final ZipEntry ze = zf.getEntry( ComponentsXmlArchiverFileFilter.COMPONENTS_XML_PATH );
 
             assertNotNull( ze );
 
-            out = new FileOutputStream( descriptorFile );
-
-            IOUtil.copy( zf.getInputStream( ze ), out );
-            out.close();
-            out = null;
-            zf.close();
-            zf = null;
+            Files.copy( zf.getInputStream( ze ), descriptorFile.toPath() );
         }
-        finally
-        {
-            IOUtil.close( out );
-            try
-            {
-                if ( zf != null )
-                {
-                    zf.close();
-                }
-            }
-            catch ( final IOException e )
-            {
-                // Suppressed.
-            }
-        }
-        
 
         final SAXBuilder builder = new SAXBuilder( false );
 
diff --git a/src/test/java/org/apache/maven/plugins/assembly/io/DefaultAssemblyReaderTest.java b/src/test/java/org/apache/maven/plugins/assembly/io/DefaultAssemblyReaderTest.java
index 9e4dda2..f29e73d 100644
--- a/src/test/java/org/apache/maven/plugins/assembly/io/DefaultAssemblyReaderTest.java
+++ b/src/test/java/org/apache/maven/plugins/assembly/io/DefaultAssemblyReaderTest.java
@@ -19,7 +19,26 @@ package org.apache.maven.plugins.assembly.io;
  * under the License.
  */
 
-import junit.framework.TestCase;
+import static org.easymock.EasyMock.expect;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.model.Model;
@@ -37,38 +56,24 @@ import org.apache.maven.plugins.assembly.model.Repository;
 import org.apache.maven.plugins.assembly.model.io.xpp3.AssemblyXpp3Writer;
 import org.apache.maven.plugins.assembly.model.io.xpp3.ComponentXpp3Reader;
 import org.apache.maven.plugins.assembly.model.io.xpp3.ComponentXpp3Writer;
-import org.apache.maven.plugins.assembly.testutils.TestFileManager;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.interpolation.fixed.FixedStringSearchInterpolator;
 import org.codehaus.plexus.interpolation.fixed.InterpolationState;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.codehaus.plexus.util.IOUtil;
 import org.easymock.classextension.EasyMockSupport;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import static org.easymock.EasyMock.expect;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 public class DefaultAssemblyReaderTest
-    extends TestCase
 {
-
-    private TestFileManager fileManager;
+    @Rule
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
     private EasyMockSupport mockManager;
 
-
     private AssemblerConfigurationSource configSource;
 
     public static StringReader writeToStringReader( Assembly assembly )
@@ -82,10 +87,10 @@ public class DefaultAssemblyReaderTest
         return new StringReader( sw.toString() );
     }
 
-    @Override
+    @Before
     public void setUp()
     {
-        fileManager = new TestFileManager( "assembly-reader.test.", ".xml" );
+//        fileManager = new TestFileManager( "assembly-reader.test.", ".xml" );
         mockManager = new EasyMockSupport();
 
         configSource = mockManager.createMock( AssemblerConfigurationSource.class );
@@ -99,15 +104,9 @@ public class DefaultAssemblyReaderTest
         expect( configSource.getMavenSession() ).andReturn( null ).anyTimes();
     }
 
-    @Override
-    public void tearDown()
-        throws IOException
-    {
-        fileManager.cleanUp();
-    }
-
+    @Test
     public void testIncludeSiteInAssembly_ShouldFailIfSiteDirectoryNonExistent()
-        throws IOException
+        throws Exception
     {
         final File siteDir = File.createTempFile( "assembly-reader.", ".test" );
         siteDir.delete();
@@ -132,7 +131,7 @@ public class DefaultAssemblyReaderTest
         mockManager.verifyAll();
     }
 
-    // public void testReadComponent_ShouldReadComponentFromXml()
+    // @Test public void testReadComponent_ShouldReadComponentFromXml()
     // throws IOException, AssemblyReadException
     // {
     // Component component = new Component();
@@ -160,7 +159,7 @@ public class DefaultAssemblyReaderTest
     // assertEquals( "/dir", fs.getDirectory() );
     // }
     //
-    // public void testGetComponentFromFile_ShouldReadComponent()
+    // @Test public void testGetComponentFromFile_ShouldReadComponent()
     // throws IOException, AssemblyReadException
     // {
     // Component component = new Component();
@@ -209,10 +208,11 @@ public class DefaultAssemblyReaderTest
     // mockManager.verifyAll();
     // }
 
+    @Test
     public void testIncludeSiteInAssembly_ShouldAddSiteDirFileSetWhenDirExists()
-        throws IOException, InvalidAssemblerConfigurationException
+        throws Exception
     {
-        final File siteDir = fileManager.createTempDir();
+        final File siteDir = temporaryFolder.getRoot();
 
         expect( configSource.getSiteDirectory() ).andReturn( siteDir ).anyTimes();
 
@@ -234,6 +234,7 @@ public class DefaultAssemblyReaderTest
         mockManager.verifyAll();
     }
 
+    @Test
     public void testMergeComponentWithAssembly_ShouldAddOneFileSetToExistingListOfTwo()
     {
         final Assembly assembly = new Assembly();
@@ -272,6 +273,7 @@ public class DefaultAssemblyReaderTest
 
     }
 
+    @Test
     public void testMergeComponentWithAssembly_ShouldAddOneFileItemToExistingListOfTwo()
     {
         final Assembly assembly = new Assembly();
@@ -311,6 +313,7 @@ public class DefaultAssemblyReaderTest
 
     }
 
+    @Test
     public void testMergeComponentWithAssembly_ShouldAddOneDependencySetToExistingListOfTwo()
     {
         final Assembly assembly = new Assembly();
@@ -344,6 +347,7 @@ public class DefaultAssemblyReaderTest
         assertEquals( Artifact.SCOPE_SYSTEM, depSets.get( 2 ).getScope() );
     }
 
+    @Test
     public void testMergeComponentWithAssembly_ShouldAddOneRepositoryToExistingListOfTwo()
     {
         final Assembly assembly = new Assembly();
@@ -424,6 +428,7 @@ public class DefaultAssemblyReaderTest
     //
     // }
 
+    @Test
     public void testMergeComponentWithAssembly_ShouldAddOneContainerDescriptorHandlerToExistingListOfTwo()
     {
         final Assembly assembly = new Assembly();
@@ -458,8 +463,9 @@ public class DefaultAssemblyReaderTest
         assertEquals( "three", it.next().getHandlerName() );
     }
 
+    @Test
     public void testMergeComponentsWithMainAssembly_ShouldAddOneFileSetToAssembly()
-        throws IOException, AssemblyReadException
+        throws Exception
     {
         final Component component = new Component();
 
@@ -468,23 +474,13 @@ public class DefaultAssemblyReaderTest
 
         component.addFileSet( fileSet );
 
-        final File componentFile = fileManager.createTempFile();
-
-        Writer writer = null;
+        final File componentFile = temporaryFolder.newFile();
 
-        try
+        try ( Writer writer = new OutputStreamWriter( new FileOutputStream( componentFile ), "UTF-8" ) )
         {
-            writer = new OutputStreamWriter( new FileOutputStream( componentFile ), "UTF-8" );
-
             final ComponentXpp3Writer componentWriter = new ComponentXpp3Writer();
 
             componentWriter.write( writer, component );
-            writer.close();
-            writer = null;
-        }
-        finally
-        {
-            IOUtil.close( writer );
         }
 
         final String filename = componentFile.getName();
@@ -520,8 +516,9 @@ public class DefaultAssemblyReaderTest
         mockManager.verifyAll();
     }
 
+    @Test
     public void testReadAssembly_ShouldReadAssemblyWithoutComponentsInterpolationOrSiteDirInclusion()
-        throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException
+        throws Exception
     {
         final Assembly assembly = new Assembly();
         assembly.setId( "test" );
@@ -533,8 +530,9 @@ public class DefaultAssemblyReaderTest
         mockManager.verifyAll();
     }
 
+    @Test
     public void testReadAssembly_ShouldReadAssemblyWithSiteDirInclusionFromAssemblyWithoutComponentsOrInterpolation()
-        throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException
+        throws Exception
     {
         final Assembly assembly = new Assembly();
         assembly.setId( "test" );
@@ -543,11 +541,11 @@ public class DefaultAssemblyReaderTest
 
         final StringReader sr = writeToStringReader( assembly );
 
-        final File siteDir = fileManager.createTempDir();
+        final File siteDir = temporaryFolder.newFolder( "site" );
 
         expect( configSource.getSiteDirectory() ).andReturn( siteDir ).anyTimes();
 
-        final File basedir = fileManager.createTempDir();
+        final File basedir = temporaryFolder.getRoot();
 
         expect( configSource.getBasedir() ).andReturn( basedir ).anyTimes();
 
@@ -577,10 +575,11 @@ public class DefaultAssemblyReaderTest
         mockManager.verifyAll();
     }
 
+    @Test
     public void testReadAssembly_ShouldReadAssemblyWithComponentWithoutSiteDirInclusionOrInterpolation()
-        throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException
+        throws Exception
     {
-        final File componentsFile = fileManager.createTempFile();
+        final File componentsFile = temporaryFolder.newFile();
 
         final File basedir = componentsFile.getParentFile();
         final String componentsFilename = componentsFile.getName();
@@ -592,18 +591,9 @@ public class DefaultAssemblyReaderTest
 
         component.addFileSet( fs );
 
-        Writer fw = null;
-
-        try
+        try ( Writer fw = new OutputStreamWriter( new FileOutputStream( componentsFile ), "UTF-8" ) )
         {
-            fw = new OutputStreamWriter( new FileOutputStream( componentsFile ), "UTF-8" );
             new ComponentXpp3Writer().write( fw, component );
-            fw.close();
-            fw = null;
-        }
-        finally
-        {
-            IOUtil.close( fw );
         }
 
         final Assembly assembly = new Assembly();
@@ -640,11 +630,11 @@ public class DefaultAssemblyReaderTest
         mockManager.verifyAll();
     }
 
-    public void
-    testReadAssembly_ShouldReadAssemblyWithComponentInterpolationWithoutSiteDirInclusionOrAssemblyInterpolation()
-        throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException
+    @Test
+    public void testReadAssembly_ShouldReadAssemblyWithComponentInterpolationWithoutSiteDirInclusionOrAssemblyInterpolation()
+        throws Exception
     {
-        final File componentsFile = fileManager.createTempFile();
+        final File componentsFile = temporaryFolder.newFile();
 
         final File basedir = componentsFile.getParentFile();
         final String componentsFilename = componentsFile.getName();
@@ -656,18 +646,9 @@ public class DefaultAssemblyReaderTest
 
         component.addFileSet( fs );
 
-        Writer fw = null;
-
-        try
+        try( Writer fw = new OutputStreamWriter( new FileOutputStream( componentsFile ), "UTF-8" ) )
         {
-            fw = new OutputStreamWriter( new FileOutputStream( componentsFile ), "UTF-8" );
             new ComponentXpp3Writer().write( fw, component );
-            fw.close();
-            fw = null;
-        }
-        finally
-        {
-            IOUtil.close( fw );
         }
 
         final Assembly assembly = new Assembly();
@@ -705,8 +686,9 @@ public class DefaultAssemblyReaderTest
         mockManager.verifyAll();
     }
 
+    @Test
     public void testReadAssembly_ShouldReadAssemblyWithInterpolationWithoutComponentsOrSiteDirInclusion()
-        throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException
+        throws Exception
     {
         final Assembly assembly = new Assembly();
         assembly.setId( "${groupId}-assembly" );
@@ -723,7 +705,7 @@ public class DefaultAssemblyReaderTest
     {
         final StringReader sr = writeToStringReader( assembly );
 
-        final File basedir = fileManager.createTempDir();
+        final File basedir = temporaryFolder.getRoot();
 
         expect( configSource.getBasedir() ).andReturn( basedir ).anyTimes();
 
@@ -743,8 +725,9 @@ public class DefaultAssemblyReaderTest
         return new DefaultAssemblyReader().readAssembly( sr, "testLocation", null, configSource );
     }
 
+    @Test
     public void testGetAssemblyFromDescriptorFile_ShouldReadAssembly()
-        throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException
+        throws Exception
     {
         final Assembly assembly = new Assembly();
         assembly.setId( "test" );
@@ -754,7 +737,7 @@ public class DefaultAssemblyReaderTest
 
         assembly.addFileSet( fs );
 
-        final File assemblyFile = fileManager.createTempFile();
+        final File assemblyFile = temporaryFolder.newFile();
 
         final File basedir = assemblyFile.getParentFile();
 
@@ -764,17 +747,9 @@ public class DefaultAssemblyReaderTest
 
         DefaultAssemblyArchiverTest.setupInterpolators( configSource );
 
-        Writer writer = null;
-        try
+        try ( Writer writer = new OutputStreamWriter( new FileOutputStream( assemblyFile ), "UTF-8" ) )
         {
-            writer = new OutputStreamWriter( new FileOutputStream( assemblyFile ), "UTF-8" );
             new AssemblyXpp3Writer().write( writer, assembly );
-            writer.close();
-            writer = null;
-        }
-        finally
-        {
-            IOUtil.close( writer );
         }
 
         mockManager.replayAll();
@@ -786,10 +761,11 @@ public class DefaultAssemblyReaderTest
         mockManager.verifyAll();
     }
 
+    @Test
     public void testGetAssemblyForDescriptorReference_ShouldReadBinaryAssemblyRef()
-        throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException
+        throws Exception
     {
-        final File basedir = fileManager.createTempDir();
+        final File basedir = temporaryFolder.getRoot();
 
         expect( configSource.getBasedir() ).andReturn( basedir ).anyTimes();
 
@@ -808,8 +784,9 @@ public class DefaultAssemblyReaderTest
         mockManager.verifyAll();
     }
 
+    @Test
     public void testReadAssemblies_ShouldGetAssemblyDescriptorFromSingleFile()
-        throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException
+        throws Exception
     {
         final Assembly assembly = new Assembly();
         assembly.setId( "test" );
@@ -819,7 +796,7 @@ public class DefaultAssemblyReaderTest
 
         assembly.addFileSet( fs );
 
-        final File basedir = fileManager.createTempDir();
+        final File basedir = temporaryFolder.getRoot();
 
         final List<String> files = writeAssembliesToFile( Collections.singletonList( assembly ), basedir );
 
@@ -835,13 +812,11 @@ public class DefaultAssemblyReaderTest
         assertEquals( assembly.getId(), result.getId() );
     }
 
+    @Test
     public void testReadAssemblies_ShouldFailWhenSingleDescriptorFileMissing()
-        throws IOException, InvalidAssemblerConfigurationException
+        throws Exception
     {
-        final File basedir = fileManager.createTempDir();
-
-        final File assemblyFile = new File( basedir, "test.xml" );
-        assemblyFile.delete();
+        final File basedir = temporaryFolder.getRoot();
 
         try
         {
@@ -855,13 +830,11 @@ public class DefaultAssemblyReaderTest
         }
     }
 
+    @Test
     public void testReadAssemblies_ShouldIgnoreMissingSingleDescriptorFileWhenIgnoreIsConfigured()
-        throws IOException, InvalidAssemblerConfigurationException
+        throws Exception
     {
-        final File basedir = fileManager.createTempDir();
-
-        final File assemblyFile = new File( basedir, "test.xml" );
-        assemblyFile.delete();
+        final File basedir = temporaryFolder.getRoot();
 
         try
         {
@@ -874,8 +847,9 @@ public class DefaultAssemblyReaderTest
         }
     }
 
+    @Test
     public void testReadAssemblies_ShouldGetAssemblyDescriptorFromFileArray()
-        throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException
+        throws Exception
     {
         final Assembly assembly1 = new Assembly();
         assembly1.setId( "test" );
@@ -887,7 +861,7 @@ public class DefaultAssemblyReaderTest
         assemblies.add( assembly1 );
         assemblies.add( assembly2 );
 
-        final File basedir = fileManager.createTempDir();
+        final File basedir = temporaryFolder.getRoot();
 
         final List<String> files = writeAssembliesToFile( assemblies, basedir );
 
@@ -906,10 +880,11 @@ public class DefaultAssemblyReaderTest
         assertEquals( assembly2.getId(), result2.getId() );
     }
 
+    @Test
     public void testReadAssemblies_ShouldGetAssemblyDescriptorFromMultipleRefs()
-        throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException
+        throws Exception
     {
-        final File basedir = fileManager.createTempDir();
+        final File basedir = temporaryFolder.getRoot();
 
         final List<Assembly> assemblies =
             performReadAssemblies( basedir, null, new String[]{ "bin", "src" }, null );
@@ -926,8 +901,9 @@ public class DefaultAssemblyReaderTest
         assertEquals( "src", result2.getId() );
     }
 
+    @Test
     public void testReadAssemblies_ShouldGetAssemblyDescriptorFromDirectory()
-        throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException
+        throws Exception
     {
         final Assembly assembly1 = new Assembly();
         assembly1.setId( "test" );
@@ -939,7 +915,7 @@ public class DefaultAssemblyReaderTest
         assemblies.add( assembly1 );
         assemblies.add( assembly2 );
 
-        final File basedir = fileManager.createTempDir();
+        final File basedir = temporaryFolder.getRoot();
 
         writeAssembliesToFile( assemblies, basedir );
 
@@ -957,8 +933,9 @@ public class DefaultAssemblyReaderTest
         assertEquals( assembly2.getId(), result2.getId() );
     }
 
+    @Test
     public void testReadAssemblies_ShouldGetTwoAssemblyDescriptorsFromDirectoryWithThreeFiles()
-        throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException
+        throws Exception
     {
         final Assembly assembly1 = new Assembly();
         assembly1.setId( "test" );
@@ -970,11 +947,13 @@ public class DefaultAssemblyReaderTest
         assemblies.add( assembly1 );
         assemblies.add( assembly2 );
 
-        final File basedir = fileManager.createTempDir();
+        final File basedir = temporaryFolder.getRoot();
 
         writeAssembliesToFile( assemblies, basedir );
 
-        fileManager.createFile( basedir, "readme.txt", "This is just a readme file, not a descriptor." );
+        Files.write( basedir.toPath().resolve( "readme.txt" ),
+                     Arrays.asList( "This is just a readme file, not a descriptor." ), 
+                     StandardCharsets.UTF_8 );
 
         final List<Assembly> results = performReadAssemblies( basedir, null, null, basedir );
 
@@ -999,17 +978,9 @@ public class DefaultAssemblyReaderTest
         {
             final File assemblyFile = new File( dir, assembly.getId() + ".xml" );
 
-            Writer writer = null;
-            try
+            try ( Writer writer = new OutputStreamWriter( new FileOutputStream( assemblyFile ), "UTF-8" ) )
             {
-                writer = new OutputStreamWriter( new FileOutputStream( assemblyFile ), "UTF-8" );
                 new AssemblyXpp3Writer().write( writer, assembly );
-                writer.close();
-                writer = null;
-            }
-            finally
-            {
-                IOUtil.close( writer );
             }
 
             files.add( assemblyFile.getAbsolutePath() );
diff --git a/src/test/java/org/apache/maven/plugins/assembly/testutils/TestFileManager.java b/src/test/java/org/apache/maven/plugins/assembly/testutils/TestFileManager.java
deleted file mode 100644
index ae5280c..0000000
--- a/src/test/java/org/apache/maven/plugins/assembly/testutils/TestFileManager.java
+++ /dev/null
@@ -1,209 +0,0 @@
-package org.apache.maven.plugins.assembly.testutils;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class TestFileManager
-{
-
-    public static final String TEMP_DIR_PATH = System.getProperty( "java.io.tmpdir" );
-
-    private final List<File> filesToDelete = new ArrayList<>();
-
-    private final String baseFilename;
-
-    private final String fileSuffix;
-
-    private StackTraceElement callerInfo;
-
-    private boolean warnAboutCleanup = false;
-
-    public TestFileManager( final String baseFilename, final String fileSuffix )
-    {
-        this.baseFilename = baseFilename;
-        this.fileSuffix = fileSuffix;
-
-        initializeCleanupMonitoring();
-    }
-
-    private void initializeCleanupMonitoring()
-    {
-        callerInfo = new NullPointerException().getStackTrace()[2];
-
-        final Runnable warning = new Runnable()
-        {
-
-            public void run()
-            {
-                maybeWarnAboutCleanUp();
-            }
-
-        };
-
-        Thread cleanupWarning = new Thread( warning );
-
-        Runtime.getRuntime().addShutdownHook( cleanupWarning );
-    }
-
-    private void maybeWarnAboutCleanUp()
-    {
-        if ( warnAboutCleanup )
-        {
-            System.out.println( "[WARNING] TestFileManager from: " + callerInfo.getClassName() + " not cleaned up!" );
-        }
-    }
-
-    public void markForDeletion( final File toDelete )
-    {
-        filesToDelete.add( toDelete );
-        warnAboutCleanup = true;
-    }
-
-    public synchronized File createTempDir()
-    {
-        try
-        {
-            Thread.sleep( 20 );
-        }
-        catch ( final InterruptedException ignore )
-        {
-        }
-
-        final File dir = new File( TEMP_DIR_PATH, baseFilename + System.currentTimeMillis() );
-
-        //noinspection ResultOfMethodCallIgnored
-        dir.mkdirs();
-        markForDeletion( dir );
-
-        return dir;
-    }
-
-    public synchronized File createTempFile()
-        throws IOException
-    {
-        final File tempFile = File.createTempFile( baseFilename, fileSuffix );
-        tempFile.deleteOnExit();
-        markForDeletion( tempFile );
-
-        return tempFile;
-    }
-
-    public void cleanUp()
-    {
-        for ( final Iterator<File> it = filesToDelete.iterator(); it.hasNext(); )
-        {
-            final File file = it.next();
-
-            if ( file.exists() )
-            {
-                try
-                {
-                    FileUtils.forceDelete( file );
-                }
-                catch ( final Exception e )
-                {
-                    System.err.println( "Error while deleting test file/dir: " + file + "; ignoring." );
-                }
-            }
-
-            it.remove();
-        }
-
-        warnAboutCleanup = false;
-    }
-
-    /**
-     * NOTE: the file content is written using platform encoding.
-     */
-    @SuppressWarnings( "ResultOfMethodCallIgnored" )
-    public File createFile( final File dir, final String filename, final String contents )
-        throws IOException
-    {
-        final File file = new File( dir, filename );
-
-        file.getParentFile().mkdirs();
-
-        FileWriter writer = null;
-
-        try
-        {
-            writer = new FileWriter( file ); // platform encoding
-
-            writer.write( contents );
-
-            writer.close();
-            writer = null;
-        }
-        finally
-        {
-            IOUtil.close( writer );
-        }
-
-        markForDeletion( file );
-
-        return file;
-    }
-
-    /**
-     * NOTE: the file content is read using platform encoding.
-     */
-    public String getFileContents( final File file )
-        throws IOException
-    {
-        String result = null;
-
-        FileReader reader = null;
-        try
-        {
-            reader = new FileReader( file ); // platform encoding
-
-            result = IOUtil.toString( reader );
-
-            reader.close();
-            reader = null;
-        }
-        finally
-        {
-            IOUtil.close( reader );
-        }
-
-        return result;
-    }
-
-    @Override
-    protected void finalize()
-        throws Throwable
-    {
-        maybeWarnAboutCleanUp();
-
-        super.finalize();
-    }
-
-}