package nbmtools;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.util.List;
import java.util.stream.Collectors;
import java.util.zip.ZipOutputStream;
import org.apache.commons.io.IOUtils;
import scala.collection.JavaConversions;
import yokohama.unit.annotations.As;

@As
public class TestUtils {
    @As
    public static InputStream asInputStream(String s) throws IOException {
        return IOUtils.toInputStream(s, "UTF-8");
    }

    public static scala.collection.immutable.List<URI> uris(List<String> urls) {
        List<URI> uris =
                urls.stream().map(URI::create).collect(Collectors.toList());
        return JavaConversions.asScalaBuffer(uris).toList();
    }

    public static void createZipFile(File file, List<ZipEntry> entries)
            throws IOException {
        try(FileOutputStream fos = new FileOutputStream(file);
                ZipOutputStream zos = new ZipOutputStream(fos)) {
            for (ZipEntry entry : entries) {
                if (entry instanceof DirEntry) continue;
                FileEntry fileEntry = (FileEntry)entry;
				zos.putNextEntry(fileEntry.getZipEntry());
                IOUtils.copy(fileEntry.getInputStream(), zos);
            }
        }
    }
}

@@ -518,32 +518,117 @@
 UTF-8%22);%0A    %7D%0A%0A
+    @As%0A    public static URI asURI(String s) %7B%0A        return URI.create(s);%0A    %7D%0A%0A
     public stati

Add asURI method