### Question:
Main { void execute() { System.out.println(message); } Main(String message); static void main(String args[]);  }### Answer:
@Test public void testPrintMessage() { ByteArrayOutputStream binary = new ByteArrayOutputStream(); PrintStream stream = new PrintStream(binary, true); PrintStream defaultStream = System.out; try { System.setOut(stream); new Main("message").execute(); assertThat(binary.toString(), is("message" + System.getProperty("line.separator"))); } finally { System.setOut(defaultStream); } }