System.out.print() doesn't show anything in test methods

前端 未结 8 1293
春和景丽
春和景丽 2020-12-14 15:28

I\'m trying to print some data with System.out in my unit tests (@Test mehotds), but it is not showing anything. However, it works properly in

8条回答
  •  执笔经年
    2020-12-14 15:50

    Use Log

    private static Logger log = Logger.getLogger(LoggingObject.class);
    log.info("I'm starting");
    

    or System.setOut()

    private final PrintStream stdout = System.out;
    private final ByteArrayOutputStream output = new ByteArrayOutputStream();
    private TerminalView terminalview;
    

提交回复
热议问题