aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/java_tools/singlejar/javatests/com
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-04-02 17:19:29 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2015-04-03 20:36:33 +0000
commit4544389bcf149b63579c9ebb59bd0dabe1e0b381 (patch)
tree5d99202cbed590b8cf5cbfd605bc1e997b189c1c /src/java_tools/singlejar/javatests/com
parentfe5754f00dab5c10437dcdf4cb50cc2ac224a42a (diff)
Adds ZipCombiner#addZip(InputStream).
-- MOS_MIGRATED_REVID=90172709
Diffstat (limited to 'src/java_tools/singlejar/javatests/com')
-rw-r--r--src/java_tools/singlejar/javatests/com/google/devtools/build/singlejar/ZipCombinerTest.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/java_tools/singlejar/javatests/com/google/devtools/build/singlejar/ZipCombinerTest.java b/src/java_tools/singlejar/javatests/com/google/devtools/build/singlejar/ZipCombinerTest.java
index aba561bfd3..e5e89f0ac1 100644
--- a/src/java_tools/singlejar/javatests/com/google/devtools/build/singlejar/ZipCombinerTest.java
+++ b/src/java_tools/singlejar/javatests/com/google/devtools/build/singlejar/ZipCombinerTest.java
@@ -72,6 +72,12 @@ public class ZipCombinerTest {
@Rule public TemporaryFolder tmp = new TemporaryFolder();
@Rule public ExpectedException thrown = ExpectedException.none();
+ private InputStream sampleZipStream() {
+ ZipFactory factory = new ZipFactory();
+ factory.addFile("hello.txt", "Hello World!");
+ return factory.toInputStream();
+ }
+
private File sampleZip() throws IOException {
ZipFactory factory = new ZipFactory();
factory.addFile("hello.txt", "Hello World!");
@@ -140,6 +146,15 @@ public class ZipCombinerTest {
assertEntry(zipInput, filename, date.getTime(), content.getBytes(ISO_8859_1));
}
+ @Test public void testInputStreamZip() throws IOException {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ try (ZipCombiner zipCombiner = new ZipCombiner(out)) {
+ zipCombiner.addZip(sampleZipStream());
+ }
+ FakeZipFile expectedResult = new FakeZipFile().addEntry("hello.txt", "Hello World!", true);
+ expectedResult.assertSame(out.toByteArray());
+ }
+
@Test public void testCompressedDontCare() throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try (ZipCombiner zipCombiner = new ZipCombiner(out)) {