1- /* groovylint-disable LineLength, TrailingWhitespace */
1+ /* groovylint-disable LineLength, MethodName, TrailingWhitespace */
22package nextflow.validation
33
4- import java.nio.file.Path
4+ import groovy.transform.CompileDynamic
55
66import nextflow.Session
7- import spock.lang.Shared
87import org.junit.Rule
98import test.Dsl2Spec
109import test.OutputCapture
@@ -14,27 +13,18 @@ import nextflow.validation.config.ValidationConfig
1413/**
1514 * @author : nvnieuwk <[email protected] > 1615 */
16+
17+ @CompileDynamic
1718class ConfigTest extends Dsl2Spec {
1819
1920 @Rule
20- OutputCapture capture = new OutputCapture ()
21-
22- @Shared String pluginsMode
23-
24- Path root = Path . of(' .' ). toAbsolutePath(). normalize()
25- Path getRoot () { this . root }
26- String getRootString () { this . root. toString() }
21+ final private OutputCapture capture = new OutputCapture ()
2722
28- private Session session
29-
30- def setup () {
31- session = Mock (Session )
32- session. getBaseDir() >> getRoot()
33- }
23+ final private Session session = Mock (Session )
3424
35- def ' test valid config' () {
25+ void ' test valid config' () {
3626 given :
37- def config = [
27+ Map config = [
3828 lenientMode : true ,
3929 monochromeLogs : true ,
4030 maxErrValSize : 20 ,
@@ -60,25 +50,24 @@ class ConfigTest extends Dsl2Spec {
6050 unrecognisedHeaders : ' error'
6151 ]
6252 ]
63- def params = [:]
6453
6554 when :
6655 new ValidationConfig (config, session)
67- def stdout = capture
56+ List< String > stdout = capture
6857 .toString()
6958 .readLines()
70- .findResults { it . contains(' WARN' ) ? it : null }
59+ .findResults { line -> line . contains(' WARN' ) ? line : null }
7160
7261 then :
7362 noExceptionThrown()
7463 ! stdout
7564 }
7665
77- def ' test valid config - GStrings' () {
66+ void ' test valid config - GStrings' () {
7867 given :
79- def randomString = ' randomString'
80- def errorLevel = ' error'
81- def config = [
68+ String randomString = ' randomString'
69+ String errorLevel = ' error'
70+ Map config = [
8271 lenientMode : true ,
8372 monochromeLogs : true ,
8473 maxErrValSize : 20 ,
@@ -104,23 +93,22 @@ class ConfigTest extends Dsl2Spec {
10493 unrecognisedHeaders : " ${ errorLevel} "
10594 ]
10695 ]
107- def params = [:]
10896
10997 when :
11098 new ValidationConfig (config, session)
111- def stdout = capture
99+ List< String > stdout = capture
112100 .toString()
113101 .readLines()
114- .findResults { it . contains(' WARN' ) ? it : null }
102+ .findResults { line -> line . contains(' WARN' ) ? line : null }
115103
116104 then :
117105 noExceptionThrown()
118106 ! stdout
119107 }
120108
121- def ' test invalid config' () {
109+ void ' test invalid config' () {
122110 given :
123- def config = [
111+ Map config = [
124112 lenientMode : ' notABoolean' ,
125113 monochromeLogs : 12 ,
126114 showHiddenParams : ' notABoolean' ,
@@ -147,14 +135,13 @@ class ConfigTest extends Dsl2Spec {
147135 unrecognisedHeaders : 589654
148136 ]
149137 ]
150- def params = [:]
151138
152139 when :
153140 new ValidationConfig (config, session)
154- def stdout = capture
141+ List< String > stdout = capture
155142 .toString()
156143 .readLines()
157- .findResults { it . contains(' WARN' ) ? it : null }
144+ .findResults { line -> line . contains(' WARN' ) ? line : null }
158145
159146 then :
160147 noExceptionThrown()
0 commit comments