### Question:
Console { public static Console.Instance println(Object line) { return Env.console().println(line); } private  Console(); static FuncUnit1<Object> printf(String format); static Console.Instance print(Object text); static Console.Instance println(Object line); static Console.Instance println(); static Console.Instance outPrint(Object text); static Console.Instance outPrintln(Object line); static Console.Instance outPrintln(); static Console.Instance errPrint(Object text); static Console.Instance errPrintln(Object line); static Console.Instance errPrintln(); static String readln(); static String pollln(); static Promise<String> inputLine(); static void stopRead(); static StubRecord<Object> useStub(RunBody<E> body); static StubRecord<D> useStub(ComputeBody<D, E> body); static StubRecord<Object> useStub(FuncUnit1<ConsoleInQueue> holder, RunBody<E> body); static StubRecord<D> useStub(FuncUnit1<ConsoleInQueue> holder, ComputeBody<D, E> body); static StubRecord<Object> useStub(Stream<String> inLines, RunBody<E> body); static StubRecord<Object> useStub(ConsoleInQueue inQueue, RunBody<E> body); static StubRecord<D> useStub(Stream<String> inLines, ComputeBody<D, E> body); static StubRecord<D> useStub(ConsoleInQueue inQueue, ComputeBody<D, E> body); static FuncUnit1<Object> print; static FuncUnit1<Object> println; }### Answer:
@Test public void testStub_out() { val stub = new Console.Stub(); With(Env.refs.console.butWith(stub)) .run(()->{ Console .println("One") .println("Two"); val outLines = StreamPlus.from(stub.outLines()).toJavaList(); assertEquals( "[One, Two]", outLines.toString()); stub.clearOutLines(); }); }