diff --git a/build.gradle.kts b/build.gradle.kts index 7f15f5da..f5b0e9d2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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") } diff --git a/src/test/java/org/zaproxy/VerifyScripts.java b/src/test/java/org/zaproxy/VerifyScripts.java index 29bf4348..f1671060 100644 --- a/src/test/java/org/zaproxy/VerifyScripts.java +++ b/src/test/java/org/zaproxy/VerifyScripts.java @@ -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; @@ -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; @@ -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; @@ -116,9 +120,16 @@ private static Stream scriptsRuby() { } private static Stream 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 testData(String extension, Compilable engine) {