No, this unit test is not worth the time or the disk space. Unit testing is to make sure you get logic right. If there's no logic, there is nothing to be gained from the test. Its cost-benefit ratio is infinite.
You should unit test a method if it has branching logic, loops, or exception handling. But if all it does is call another method, then forget it. The best way to find out whether method X calls method Y is to look at the code.
Having said that, if you do insist on testing this, you should use the System.setOut
method, passing a ByteArrayOutputStream
that you've wrapped in a PrintStream
, and then verify the contents of the underlying byte[]
at the end.