1 6 21 22 package de.schlichtherle.util.zip; 23 24 import java.security.SecureRandom ; 25 import java.util.Random ; 26 import java.util.logging.Logger ; 27 28 import junit.framework.*; 29 30 35 public class TextDataRaesZipTest extends RaesZipTestBase { 36 37 private static final Logger logger 38 = Logger.getLogger(TextDataRaesZipTest.class.getName()); 39 40 private static final byte[] data; 41 static { 42 boolean ea = false; 43 assert ea = true; logger.config("Java assertions enabled: " + ea); 45 46 final String text = "This is a truly compressible text!\n"; 47 final int count = 1024 * 1024 / text.length(); 48 final int length = count * text.length(); StringBuffer buf = new StringBuffer (length); 50 for (int i = 0; i < count; i++) { 51 buf.append(text); 52 } 53 data = buf.toString().getBytes(); 54 logger.config("Created " + data.length + " bytes of highly compressible text as the data."); 55 } 56 57 public static Test suite() throws Exception { 58 TestSuite suite = new TestSuite(TextDataRaesZipTest.class); 59 60 return suite; 61 } 62 63 64 public TextDataRaesZipTest(String testName) { 65 super(testName); 66 } 67 68 protected void setUp() throws Exception { 69 super.data = TextDataRaesZipTest.data; 70 71 super.setUp(); 72 } 73 } 74 | Popular Tags |