Skip to content

Commit abefa1f

Browse files
committed
[PLXCOMP-107] Testcase added, works as expected
1 parent 4d9f3a2 commit abefa1f

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.codehaus.plexus.archiver.zip;
2+
3+
import org.codehaus.plexus.PlexusTestCase;
4+
import org.codehaus.plexus.components.io.resources.PlexusIoResource;
5+
6+
import java.io.File;
7+
import java.io.InputStream;
8+
import java.util.HashSet;
9+
import java.util.Iterator;
10+
import java.util.Set;
11+
12+
public class PlexusIoZipFileResourceCollectionTest
13+
extends PlexusTestCase
14+
{
15+
16+
public void testFilesWithIllegalHtmlChars()
17+
throws Exception
18+
{
19+
File testZip = new File( getBasedir(), "src/test/resources/archiveWithIllegalHtmlFileName.zip" );
20+
Set<String> seen = new HashSet<String>( );
21+
seen.add( "AFileThatNeedsHtmlEsc%3F&gt" );
22+
seen.add( "Afile&lt;Yo&gt;.txt" );
23+
seen.add( "File With Space.txt" );
24+
seen.add( "FileWith%.txt" );
25+
PlexusIoZipFileResourceCollection prc = new PlexusIoZipFileResourceCollection();
26+
prc.setFile( testZip );
27+
final Iterator<PlexusIoResource> entries = prc.getEntries();
28+
while (entries.hasNext()){
29+
final PlexusIoResource next = entries.next();
30+
assertTrue( next.getName() + "was not present", seen.remove( next.getName() ) );
31+
final InputStream contents = next.getContents();
32+
contents.close();
33+
}
34+
}
35+
36+
}
Binary file not shown.

0 commit comments

Comments
 (0)