commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [3/6] commons-compress git commit: Sometimes skip entries.
Date Wed, 24 Feb 2016 14:54:04 GMT
Sometimes skip entries.


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/deb891f8
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/deb891f8
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/deb891f8

Branch: refs/heads/master
Commit: deb891f8fe6ff72cfab4c63eb975207fc359e62a
Parents: 617860e
Author: Dawid Weiss <dawid.weiss@carrotsearch.com>
Authored: Tue Feb 23 15:55:26 2016 +0100
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Wed Feb 24 15:42:19 2016 +0100

----------------------------------------------------------------------
 .../commons/compress/archivers/sevenz/SevenZFileTest.java    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/deb891f8/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
index ce17218..fe47652 100644
--- a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
@@ -26,6 +26,7 @@ import java.security.NoSuchAlgorithmException;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Random;
 
 import javax.crypto.Cipher;
 
@@ -67,11 +68,16 @@ public class SevenZFileTest extends AbstractTestCase {
 			// "PPMd.7z", 
 		};
 
+		// TODO: use randomizedtesting for predictable, but different, randomness.
+		Random rnd = new Random(0xdeadbeef);
 		for (String fileName : variants) {
 		    archive = new SevenZFile(getFile("COMPRESS-320/" + fileName));
 
 		    while ((entry = archive.getNextEntry()) != null) {
-				// TODO: randomly skip reading entries.
+				// Sometimes skip reading entries.
+		    	if (rnd.nextBoolean()) {
+		    		continue;
+		    	}
 
 				if (entry.hasStream()) {
 				    assertTrue(entriesByName.containsKey(entry.getName()));


Mime
View raw message