forked from plusone/plusone-commons
test: 减少测试时处理的数据量
This commit is contained in:
@@ -73,11 +73,11 @@ public class ZipTools {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try (DeflaterOutputStream dos = new DeflaterOutputStream(baos, new Deflater(level))) {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
try (DeflaterOutputStream dos = new DeflaterOutputStream(out, new Deflater(level))) {
|
||||
dos.write(input);
|
||||
dos.finish();
|
||||
return baos.toByteArray();
|
||||
return out.toByteArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,11 +94,11 @@ public class ZipTools {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try (InflaterOutputStream dos = new InflaterOutputStream(baos, new Inflater())) {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
try (InflaterOutputStream dos = new InflaterOutputStream(out, new Inflater())) {
|
||||
dos.write(input);
|
||||
dos.finish();
|
||||
return baos.toByteArray();
|
||||
return out.toByteArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ZipToolsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void zip_WithWrongLevel() throws IOException, DataFormatException {
|
||||
void zip_WithWrongLevel() {
|
||||
Random random = new Random();
|
||||
final int levelGtMax = random.nextInt() + 9;
|
||||
assertThrows(IllegalArgumentException.class, () -> ZipTools.zip(bytes, levelGtMax));
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user