i think you can get rid of a level of try-catch nesting here.

1) add a 'throws Exception' to the test method.   If an exception is thrown junit will fail the test case.
2) get rid of the boolean success stuff
3) Add an assertEquals(output.contains(new URI("hdfs://" + localhost + ":8000"), true);
4) Add an assertEquals(output.contains(new URI("hdfs://127.0.0.1:8001"), true);

Also double check the positions of the assert arguments.   In test ng the first arg is the actual value and the second arg is the expected value.  If junit expects a different order please swap their positions.