/**
 * The MIT License (MIT)
 *
 * Copyright (c) 2016-2017 Maksim Gramin
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.github.mgramin.sqlboot.util;

import org.apache.commons.io.FileUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by MGramin on 28.11.2016.
 */
public class ZipFileTest {

    @Rule
    public TemporaryFolder temporaryFolder = new TemporaryFolder();

    @Test
    public void create() throws Exception {
        final File tempFile = temporaryFolder.newFile("ddl_result.zip");

        Map<String, byte[]> files = new HashMap<>();
        files.put("persons.sql", "create table persons ... ;".getBytes());
        files.put("jobs.sql", "create table jobs ... ;".getBytes());

        FileUtils.writeByteArrayToFile(tempFile, new ZipFile(files).content());
    }

}
@@ -1189,16 +1189,178 @@
 .util;%0A%0A
+import static jersey.repackaged.com.google.common.collect.ImmutableMap.of;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport java.io.File;%0Aimport java.util.Map;%0A
 import o
@@ -1391,16 +1391,16 @@
 eUtils;%0A
-
 import o
@@ -1482,78 +1482,8 @@
 r;%0A%0A
-import java.io.File;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0A
 /**%0A
@@ -1798,42 +1798,10 @@
 s = 
-new HashMap%3C%3E();%0A        files.put
+of
 (%22pe
@@ -1851,18 +1851,17 @@
 tBytes()
-);
+,
 %0A       
@@ -1865,18 +1865,12 @@
     
-files.put(
+    
 %22job
@@ -1916,17 +1916,16 @@
 tes());%0A
-%0A
         
@@ -1992,20 +1992,59 @@
 content());%0A
+        assertTrue(tempFile.exists());%0A
     %7D%0A%0A%7D

fix test for ZipFile