package ru.job4j.threads;

import org.junit.Test;

import java.io.File;

import static org.junit.Assert.assertTrue;

/**
 * Test Class PackZipTest.
 *
 * @author shustovakv
 * @since 10.02.2019
 */
public class PackZipTest {
    @Test
    public void whenPackZipCreateZipFile() {
        String[] args = {"java -jar pack.jar", "-d", "C:\\Users\\Kseniya\\AppData\\Local\\Temp\\parent", "-e", "java.xml", "-o", "example.zip"};
        Args argument = new Args(args);
        PackZip packZip = new PackZip();
        packZip.zip(argument);
        assertTrue(new File(argument.directory() + "\\" + argument.output()).exists());
    }
}

@@ -65,16 +65,151 @@
 o.File;%0A
+import java.io.IOException;%0Aimport java.util.Arrays;%0A%0Aimport static org.hamcrest.core.Is.is;%0Aimport static org.junit.Assert.assertThat;
 %0Aimport 
@@ -353,16 +353,17 @@
 pTest %7B%0A
+%0A
     @Tes
@@ -388,28 +388,19 @@
 when
-PackZipCreateZipFile
+ArgsIsValid
 () %7B
@@ -585,16 +585,921 @@
 (args);%0A
+        assertThat(argument.directory(), is(%22C:%5C%5CUsers%5C%5CKseniya%5C%5CAppData%5C%5CLocal%5C%5CTemp%5C%5Cparent%22));%0A        assertThat(argument.output(), is(%22example.zip%22));%0A        assertThat(argument.exclude(), is(Arrays.asList(%22java.xml%22)));%0A    %7D%0A%0A    @Test%0A    public void whenPackZipCreateTestZipFile() throws IOException %7B%0A        String path = System.getProperty(%22java.io.tmpdir%22);%0A        String parent = path + %22/parent%22;%0A        new File(parent).mkdirs();%0A        new File(parent + %22/child1%22).mkdirs();%0A        new File(parent + %22/child2%22).mkdirs();%0A        new File(parent + %22/child1/child3%22).mkdirs();%0A        File file = new File(parent + %22/child1/child3/test.txt%22);%0A        file.createNewFile();%0A        new File(parent + %22/child1/child3/test.txt%22).createNewFile();%0A        String%5B%5D args = %7B%22java -jar pack.jar%22, %22-d%22, parent, %22-e%22, %22java.xml%22, %22-o%22, %22myFolder.zip%22%7D;%0A        Args argument = new Args(args);%0A
         

Архивировать проект. [#861] Добавила тест.