Skip to content

Commit 525ab42

Browse files
jorsolplamentotev
authored andcommitted
test: Improvements to ArchiveFileComparator
Signed-off-by: Jorge Solórzano <jorsol@gmail.com>
1 parent 85db79b commit 525ab42

File tree

4 files changed

+155
-160
lines changed

4 files changed

+155
-160
lines changed

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@
140140
<version>5.1.0</version>
141141
<scope>test</scope>
142142
</dependency>
143+
<dependency>
144+
<groupId>org.assertj</groupId>
145+
<artifactId>assertj-core</artifactId>
146+
<version>3.23.1</version>
147+
<scope>test</scope>
148+
</dependency>
143149
</dependencies>
144150

145151
<build>

src/test/java/org/codehaus/plexus/archiver/tar/TarArchiverTest.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import org.codehaus.plexus.util.FileUtils;
5959
import org.codehaus.plexus.util.IOUtil;
6060
import org.codehaus.plexus.util.Os;
61+
import org.junit.Assert;
6162
import org.junit.Test;
6263

6364
/**
@@ -527,19 +528,7 @@ public void testGzipFIleHandleLeak()
527528
final File tarFile2 = tarHandler.createTarfile2( tarFile );
528529
final TarFile cmp1 = tarHandler.newTarFile( tarFile );
529530
final TarFile cmp2 = new TarFile( tarFile2 );
530-
ArchiveFileComparator.forEachTarArchiveEntry( cmp1, new ArchiveFileComparator.TarArchiveEntryConsumer()
531-
{
532-
533-
@Override
534-
public void accept( TarArchiveEntry ze1 )
535-
throws IOException
536-
{
537-
final String name1 = ze1.getName();
538-
assertNotNull( name1 );
539-
540-
}
541-
542-
} );
531+
ArchiveFileComparator.forEachTarArchiveEntry( cmp1, ze1 -> Assert.assertNotNull( ze1.getName() ) );
543532
cmp1.close();
544533
cmp2.close();
545534

@@ -571,7 +560,7 @@ private void testCreateResourceCollection( TarHandler tarHandler )
571560
final File tarFile2 = tarHandler.createTarfile2( tarFile );
572561
final TarFile cmp1 = tarHandler.newTarFile( tarFile );
573562
final TarFile cmp2 = new TarFile( tarFile2 );
574-
ArchiveFileComparator.assertEquals( cmp1, cmp2, "prfx/" );
563+
ArchiveFileComparator.assertTarEquals( cmp1, cmp2, "prfx/" );
575564
cmp1.close();
576565
cmp2.close();
577566
}
@@ -591,7 +580,7 @@ public void testSymlinkArchivedFileSet()
591580

592581
final TarFile cmp1 = new TarFile( tarFile );
593582
final TarFile cmp2 = new TarFile( tarFile2 );
594-
ArchiveFileComparator.assertEquals( cmp1, cmp2, "" );
583+
ArchiveFileComparator.assertTarEquals( cmp1, cmp2, "" );
595584
}
596585

597586
}

0 commit comments

Comments
 (0)