Skip to content

Commit 8e72706

Browse files
authored
Merge pull request #387 from raul-arabaolaza/FIX_TESTS_GUAVA
Do not use Guava's `NullOutputStream`
2 parents 717ba2e + 33c3dbe commit 8e72706

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/test/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/GroovyCallSiteSelectorTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@
2424

2525
package org.jenkinsci.plugins.scriptsecurity.sandbox.groovy;
2626

27-
import com.google.common.io.NullOutputStream;
2827
import groovy.lang.Binding;
2928
import groovy.lang.GString;
3029
import groovy.lang.Script;
3130
import hudson.EnvVars;
3231
import hudson.model.BooleanParameterValue;
3332
import hudson.model.Hudson;
33+
import java.io.IOException;
34+
import java.io.OutputStream;
3435
import java.io.PrintWriter;
3536
import java.lang.reflect.Method;
3637
import java.util.ArrayList;
@@ -59,7 +60,12 @@ public class GroovyCallSiteSelectorTest {
5960
}
6061

6162
@Test public void overloads() throws Exception {
62-
PrintWriter receiver = new PrintWriter(new NullOutputStream());
63+
PrintWriter receiver = new PrintWriter(new OutputStream() {
64+
@Override
65+
public void write(int b) throws IOException {
66+
// Do nothing, we do not care
67+
}
68+
});
6369
assertEquals(PrintWriter.class.getMethod("print", Object.class), GroovyCallSiteSelector.method(receiver, "print", new Object[] {new Object()}));
6470
assertEquals(PrintWriter.class.getMethod("print", String.class), GroovyCallSiteSelector.method(receiver, "print", new Object[] {"message"}));
6571
assertEquals(PrintWriter.class.getMethod("print", int.class), GroovyCallSiteSelector.method(receiver, "print", new Object[] {42}));

0 commit comments

Comments
 (0)