|
24 | 24 |
|
25 | 25 | package org.jenkinsci.plugins.scriptsecurity.sandbox.groovy;
|
26 | 26 |
|
27 |
| -import com.google.common.io.NullOutputStream; |
28 | 27 | import groovy.lang.Binding;
|
29 | 28 | import groovy.lang.GString;
|
30 | 29 | import groovy.lang.Script;
|
31 | 30 | import hudson.EnvVars;
|
32 | 31 | import hudson.model.BooleanParameterValue;
|
33 | 32 | import hudson.model.Hudson;
|
| 33 | +import java.io.IOException; |
| 34 | +import java.io.OutputStream; |
34 | 35 | import java.io.PrintWriter;
|
35 | 36 | import java.lang.reflect.Method;
|
36 | 37 | import java.util.ArrayList;
|
@@ -59,7 +60,12 @@ public class GroovyCallSiteSelectorTest {
|
59 | 60 | }
|
60 | 61 |
|
61 | 62 | @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 | + }); |
63 | 69 | assertEquals(PrintWriter.class.getMethod("print", Object.class), GroovyCallSiteSelector.method(receiver, "print", new Object[] {new Object()}));
|
64 | 70 | assertEquals(PrintWriter.class.getMethod("print", String.class), GroovyCallSiteSelector.method(receiver, "print", new Object[] {"message"}));
|
65 | 71 | assertEquals(PrintWriter.class.getMethod("print", int.class), GroovyCallSiteSelector.method(receiver, "print", new Object[] {42}));
|
|
0 commit comments