/** * It's fine to pass only null arguments to setUpContext. */ @Test public void setUpContext_allNull() { ShellMsg msg = mockMsg(); logHandler.setUpContext(null, null, null); logHandler.log(msg); verify(msg).getMsg(); }
/** * A null {@link ShellProcess} will not throw an exception. */ @Test public void handleLog_nullProcess() { ShellMsg msg = mockMsg(); ShellProcess process = mockProcess(); logHandler.setUpContext(DefaultShellLogHandlerTest.class, process, null); logHandler.log(msg); verify(msg).getMsg(); }
/** * If both {@link ShellMsg} and {@link ShellProcess} are provided, both * will be used to build the log message. */ @Test public void handleLog_valid() { ShellMsg msg = mockMsg(); ShellProcess process = mockProcess(); logHandler.setUpContext(DefaultShellLogHandlerTest.class, process, null); logHandler.log(msg); verify(msg).getMsg(); verify(process).getProcessInfoString(); } }