Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-params:$jupiterVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$jupiterVersion")

testImplementation("commons-io:commons-io:2.6")
testImplementation("org.assertj:assertj-core:3.11.0")
testImplementation("org.apache.commons:commons-lang3:3.8")

// The following versions should match the ones of the add-ons.
testImplementation("org.codehaus.groovy:groovy-all:2.4.14")
testImplementation("org.jruby:jruby-complete:1.7.4")
testImplementation("org.mozilla:zest:0.14.0")
testImplementation("org.python:jython-standalone:2.7.1")
}

Expand Down
17 changes: 14 additions & 3 deletions src/test/java/org/zaproxy/VerifyScripts.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.UncheckedIOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
Expand All @@ -42,6 +43,7 @@
import javax.script.Compilable;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.SystemUtils;
import org.apache.commons.lang3.mutable.MutableInt;
import org.codehaus.groovy.jsr223.GroovyScriptEngineFactory;
Expand All @@ -51,6 +53,8 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.mozilla.zest.core.v1.ZestJSON;
import org.mozilla.zest.core.v1.ZestScript;
import org.python.core.Options;
import org.python.jsr223.PyScriptEngineFactory;

Expand Down Expand Up @@ -116,9 +120,16 @@ private static Stream<Arguments> scriptsRuby() {
}

private static Stream<Arguments> scriptsZest() {
// Just collect the files for now (Issue 114).
getFilesWithExtension(".zst");
return Stream.empty();
return testData(
".zst",
reader -> {
try {
assertThat(ZestJSON.fromString(IOUtils.toString(reader)))
.isInstanceOf(ZestScript.class);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
});
}

private static Stream<Arguments> testData(String extension, Compilable engine) {
Expand Down