### Question:
MetaToolTaskListFSRoot extends MetaToolTask { @Override void execute() { Set<String> hdfsRoots = getObjectStore().listFSRoots(); if (hdfsRoots != null) { System.out.println("Listing FS Roots.."); for (String s : hdfsRoots) { System.out.println(s); } } else { System.err.println("Encountered error during listFSRoot"); } }    }### Answer:
@Test public void testListFSRoot() throws Exception { String fsRoot1 = "hdfs: String fsRoot2 = "hdfs: ObjectStore mockObjectStore = Mockito.mock(ObjectStore.class); when(mockObjectStore.listFSRoots()).thenReturn(Sets.newHashSet(fsRoot1, fsRoot2)); OutputStream os = new ByteArrayOutputStream(); System.setOut(new PrintStream(os)); MetaToolTaskListFSRoot t = new MetaToolTaskListFSRoot(); t.setCommandLine(new HiveMetaToolCommandLine(new String[] {"-listFSRoot"})); t.setObjectStore(mockObjectStore); t.execute(); assertTrue(os.toString() + " doesn't contain " + fsRoot1, os.toString().contains(fsRoot1)); assertTrue(os.toString() + " doesn't contain " + fsRoot2, os.toString().contains(fsRoot2)); }