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