package org.stefanl.closure_utilities.internal;


import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.stefanl.closure_utilities.utilities.FsTool;

import javax.annotation.Nonnull;
import java.io.File;
import java.util.Collection;
import java.util.List;

public abstract class AbstractBuildTest<A extends AbstractBuilder<B>, B> {

    protected final A builder;

    protected final Class<B> buildOptionsClass;

    protected B builderOptions;

    protected File outputDirectory;

    protected AbstractBuildTest(@Nonnull Class<A> builderClass,
                                @Nonnull Class<B> buildOptionsClass)
            throws InstantiationException, IllegalAccessException {
        builder = builderClass.newInstance();
        this.buildOptionsClass = buildOptionsClass;
    }


    protected void setUp() throws Exception {
        builderOptions = buildOptionsClass.newInstance();
        builder.setBuildOptions(builderOptions);
        outputDirectory = FsTool.getTempDirectory();
    }

    protected void tearDown() throws Exception {
        outputDirectory = null;
        builderOptions = null;
        builder.reset();
    }

    @Nonnull
    protected File getApplicationDirectory() {
        return new File("src/test/resources/app");
    }

    @Nonnull
    protected File getApplicationDirectory(String path) {
        return new File(getApplicationDirectory(), path);
    }

    @Nonnull
    protected Collection<File> getGssSourceDirectories() {
        return Sets.newHashSet(getApplicationDirectory("src/gss/"));
    }

    @Nonnull
    protected List<String> getGssEntryPoints() {
        return Lists.newArrayList(Lists.newArrayList("company-import"));
    }

    @Nonnull
    protected Collection<File> getSoySourceDirectories() {
        return Sets.newHashSet(getApplicationDirectory("src/soy"));
    }


}

@@ -249,26 +249,25 @@
 va.util.
-Collection
+ArrayList
 ;%0Aimport
@@ -277,19 +277,22 @@
 va.util.
-Lis
+HashSe
 t;%0A%0Apubl
@@ -1455,34 +1455,31 @@
   protected 
-Collection
+HashSet
 %3CFile%3E getGs
@@ -1604,16 +1604,21 @@
 otected 
+Array
 List%3CStr
@@ -1755,31 +1755,299 @@
 ted 
-Collection%3CFile%3E getSoy
+HashSet%3CFile%3E getSoySourceDirectories() %7B%0A        return Sets.newHashSet(getApplicationDirectory(%22src/soy%22));%0A    %7D%0A%0A    @Nonnull%0A    protected ArrayList%3CString%3E getJavascriptEntryPoints() %7B%0A        return Lists.newArrayList(%22%22);%0A    %7D%0A%0A    @Nonnull%0A    protected HashSet%3CFile%3E getJavascript
 Sour
@@ -2116,34 +2116,41 @@
 nDirectory(%22src/
-soy
+javascript
 %22));%0A    %7D%0A%0A%0A%7D%0A

modify function return types for abstract build test