@Override
            public boolean hasNext() {
                return !consumed;
            }
", "Dockerfile.test" }, fileSets.get(1).getExcludes());
        Assertions.assertNull(fileSets.get(1).getIncludes());
    }

    private List<FileSet> getFileSetsToVerify(int invocations) {
        ArgumentCaptor<FileSet> fileSetCapture = ArgumentCaptor.forClass(FileSet.class);
        Mockito.verify(tarArchiver, Mockito.times(invocations)).addFileSet(fileSetCapture.capture());

        return fileSetCapture.getAllValues();
    }

    private List<ArchivedFileSet> getArchivedFileSetsToVerify(String input, String destFileName, int count) {
        Mockito.verify(tarArchiver).addFile(new File(input).getAbsoluteFile(), destFileName);

        ArgumentCaptor<ArchivedFileSet> archivedFileSetCapture = ArgumentCaptor.forClass(ArchivedFileSet.class);
        Mockito.verify(tarArchiver, Mockito.times(count)).addArchivedFileSet(archivedFileSetCapture.capture());

        return archivedFileSetCapture.getAllValues();
    }

    @Test
    void testArchiveCreationDockerfileWithDirAssembly() throws MojoExecutionException, NoSuchArchiverException {
        MojoParameters mojoParams = mockMojoParams(mockMavenProject());

        BuildImageConfiguration buildImageConfiguration = new BuildImageConfiguration.Builder()
            .dockerFile(DockerAssemblyManagerTest.class.getResource("/docker/Dockerfile.test").getPath())
            .assembly(new AssemblyConfiguration.Builder()
                .mode(AssemblyMode.dir.name())
                .build()
            )
            .build();
        buildImageConfiguration.initAndValidate(logger);

        Mockito.doReturn(tarArchiver).when(archiverManager).getArchiver("tar");
        File tarArchive = assemblyManager.createDockerTarArchive("test_image", mojoParams, buildImageConfiguration, logger, null);
        Assertions.assertNotNull(tarArchive);

        verifyArchiveManager();
    }

    @Test
    void testArchiveCreationDockerfileWithArchiveAssembly() throws MojoExecutionException, NoSuchArchiverException {
        MojoParameters mojoParams = mockMojoParams(mockMavenProject());

        BuildImageConfiguration buildImageConfiguration = new BuildImageConfiguration.Builder()
            .dockerFile(DockerAssemblyManagerTest.class.getResource("/docker/Dockerfile.test").getPath())
            .assembly(new AssemblyConfiguration.Builder()
                .mode(AssemblyMode.tar.name())
                .assemblyDef(new Assembly())
                .build()
            )
            .build();
        buildImageConfiguration.initAndValidate(logger);

        Mockito.doReturn(tarArchiver).when(archiverManager).getArchiver("tar");
        File tarArchive = assemblyManager.createDockerTarArchive("test_image", mojoParams, buildImageConfiguration, logger, null);
        Assertions.assertNotNull(tarArchive);

        List<FileSet> fileSets= getFileSetsToVerify(1);
        Assertions.assertArrayEquals(new String[] { "target/**", "Dockerfile.test" }, fileSets.get(0).getExcludes());
        Assertions.assertNull(fileSets.get(0).getIncludes());

        List<ArchivedFileSet> archivedFileSets = getArchivedFileSetsToVerify("target/test_image/build/Dockerfile.test", "Dockerfile.test", 1);
        Assertions.assertEquals(new File("target/test_image/build/maven.tar").getAbsoluteFile(), archivedFileSets.get(0).getArchive());
        Assertions.assertEquals("maven/", archivedFileSets.get(0).getPrefix());
    }

    @Test
    void testArchiveCreationDockerfileWithMultipleArchiveAssemblies() throws MojoExecutionException, NoSuchArchiverException {
        MojoParameters mojoParams = mockMojoParams(mockMavenProject());

        BuildImageConfiguration buildImageConfiguration = new BuildImageConfiguration.Builder()
            .dockerFile(DockerAssemblyManagerTest.class.getResource("/docker/Dockerfile.test").getPath())
            .assemblies(Arrays.asList(
                new AssemblyConfiguration.Builder()
                    .name("first")
                    .mode(AssemblyMode.tar.name())
                    .assemblyDef(new Assembly())
                    .build(),
                new AssemblyConfiguration.Builder()
                    .name("second")
                    .mode(AssemblyMode.tar.name())
                    .assemblyDef(new Assembly())
                    .build()
            ))
            .build();
        buildImageConfiguration.initAndValidate(logger);

        Mockito.doReturn(tarArchiver).when(archiverManager).getArchiver("tar");
        File tarArchive = assemblyManager.createDockerTarArchive("test_image", mojoParams, buildImageConfiguration, logger, null);
        Assertions.assertNotNull(tarArchive);

        List<FileSet> fileSets = getFileSetsToVerify(1);
        Assertions.assertArrayEquals(new String[] { "target/**", "Dockerfile.test" }, fileSets.get(0).getExcludes());
        Assertions.assertNull(fileSets.get(0).getIncludes());

        List<ArchivedFileSet> archivedFileSets = getArchivedFileSetsToVerify("target/test_image/build/Dockerfile.test", "Dockerfile.test", 2);
        Assertions.assertEquals(new File("target/test_image/build/first.tar").getAbsoluteFile(), archivedFileSets.get(0).getArchive());
        Assertions.assertEquals("first/", archivedFileSets.get(0).getPrefix());
        Assertions.assertEquals(new File("target/test_image/build/second.tar").getAbsoluteFile(), archivedFileSets.get(1).getArchive());
        Assertions.assertEquals("second/", archivedFileSets.get(1).getPrefix());
    }

    @Test
    void testArchiveCreationNoDockerfileWithMultipleArchiveAssemblies() throws MojoExecutionException, NoSuchArchiverException {
        MojoParameters mojoParams = mockMojoParams(mockMavenProject());

        BuildImageConfiguration buildImageConfiguration = new BuildImageConfiguration.Builder()
            .assemblies(Arrays.asList(
                new AssemblyConfiguration.Builder()
                    .name("first")
                    .mode(AssemblyMode.tar.name())
                    .assemblyDef(new Assembly())
                    .build(),
                new AssemblyConfiguration.Builder()
                    .name("second")
                    .mode(AssemblyMode.tar.name())
                    .assemblyDef(new Assembly())
                    .build()
            ))
            .build();
        buildImageConfiguration.initAndValidate(logger);

        Mockito.doReturn(tarArchiver).when(archiverManager).getArchiver("tar");
        File tarArchive = assemblyManager.createDockerTarArchive("test_image", mojoParams, buildImageConfiguration, logger, null);
        Assertions.assertNotNull(tarArchive);

        /*
            tarArchiver.addFile(new File("target/test_image/build/Dockerfile").getAbsoluteFile(), "Dockerfile");

            List<ArchivedFileSet> archivedFileSets = new ArrayList<>();
            tarArchiver.addArchivedFileSet(withCapture(archivedFileSets));
src/test/java/io/fabric8/maven/docker/assembly/DockerAssemblyManagerTest.java