1616
1717package com.github.j2objccontrib.j2objcgradle.tasks
1818
19+ import groovy.transform.CompileStatic
1920import org.apache.commons.io.output.TeeOutputStream
2021import org.gradle.api.InvalidUserDataException
2122import org.gradle.api.Project
@@ -33,6 +34,7 @@ import org.junit.rules.ExpectedException
3334/**
3435 * Utils tests.
3536 */
37+ @CompileStatic
3638class UtilsTest {
3739
3840 private Project proj
@@ -182,7 +184,7 @@ class UtilsTest {
182184 ' src/test/resources/com/github/j2objccontrib/j2objcgradle/tasks/prefixes.properties' )
183185
184186 List<String > translateArgs = new ArrayList<String > ()
185- translateArgs. add(" --prefixes ${ prefixesProp.absolutePath} " )
187+ translateArgs. add(' --prefixes ' + prefixesProp. absolutePath)
186188 Properties properties = Utils . packagePrefixes(proj, translateArgs)
187189
188190 Properties expected = new Properties ()
@@ -202,7 +204,7 @@ class UtilsTest {
202204 List<String > translateArgs = new ArrayList<String > ()
203205 // prefix is overwritten by prefixes.properties
204206 translateArgs. add(' --prefix com.example.parent=ParentPrefixArg' )
205- translateArgs. add(" --prefixes ${ prefixesProp.absolutePath} " )
207+ translateArgs. add(' --prefixes ' + prefixesProp. absolutePath)
206208 // prefix overwrites prefixes.properties
207209 translateArgs. add(' --prefix com.example.parent.subdir=SubdirPrefixArg' )
208210
@@ -261,11 +263,13 @@ class UtilsTest {
261263 void testMatchRegexOutputStreams_MatchString () {
262264 ByteArrayOutputStream stdout = new ByteArrayOutputStream ()
263265 ByteArrayOutputStream stderr = new ByteArrayOutputStream ()
266+
264267 stdout. write(' written-stdout' . getBytes(' utf-8' ))
265268 stderr. write(' written-stderr' . getBytes(' utf-8' ))
266269
267- assert null != Utils . matchRegexOutputs(stdout, stderr, / (std+out)/ ). equals(' stdout' )
268- assert null != Utils . matchRegexOutputs(stdout, stderr, / (std+err)/ ). equals(' stderr' )
270+ // Match each regex against both OutputStreams
271+ assert ' stdout' == Utils . matchRegexOutputs(stdout, stderr, / (std+out)/ )
272+ assert ' stderr' == Utils . matchRegexOutputs(stdout, stderr, / (std+err)/ )
269273 }
270274
271275 @Test
0 commit comments