Create Zip-Factory for simpler handling of Zip streams

Change-Id: I66fb1e980437f9b931d71b8bc9fde54bda2aee6f
diff --git a/t/zipper.t b/t/zipper.t
new file mode 100644
index 0000000..c9eabf0
--- /dev/null
+++ b/t/zipper.t
@@ -0,0 +1,48 @@
+use strict;
+use warnings;
+use Test::More;
+use File::Basename 'dirname';
+use File::Spec::Functions qw/catfile/;
+use File::Temp ':POSIX';
+use IO::Uncompress::Unzip;
+
+use FindBin;
+BEGIN {
+  unshift @INC, "$FindBin::Bin/../lib";
+};
+
+require_ok('KorAP::XML::TEI::Zipper');
+
+my $data;
+my $outzip = tmpnam();
+
+my $zip = KorAP::XML::TEI::Zipper->new($outzip);
+
+ok($zip, 'Zipper initialized');
+
+ok($zip->new_stream('data/file1.txt')->print('hello'), 'Write to initial stream');
+ok($zip->new_stream('data/file2.txt')->print('world'), 'Write to appended stream');
+
+$zip->close;
+
+ok(-e $outzip, 'Zip exists');
+
+# Uncompress GOE/header.xml from zip file
+my $unzip = IO::Uncompress::Unzip->new($outzip, Name => 'data/file1.txt');
+
+$data .= $unzip->getline while !$unzip->eof;
+ok($unzip->close, 'Closed');
+
+is($data, 'hello', 'Data correct');
+
+
+# Uncompress GOE/header.xml from zip file
+$unzip = IO::Uncompress::Unzip->new($outzip, Name => 'data/file2.txt');
+
+$data = '';
+$data .= $unzip->getline while !$unzip->eof;
+ok($unzip->close, 'Closed');
+
+is($data, 'world', 'Data correct');
+
+done_testing;