### Question:
ServerInfoCollector { void storeShareLibInfo(final File outputDir) { try { System.out.print("Getting Sharelib Information..."); final String[] libs = client.listShareLib(null).split("\n"); try (DiagBundleEntryWriter configEntryWriter = new DiagBundleEntryWriter(outputDir, "sharelib.txt")) { for (int i = 1; i < libs.length; i++) { String files = client.listShareLib(libs[i]); configEntryWriter.writeString(files); configEntryWriter.writeNewLine(); } } System.out.println("Done"); } catch (OozieClientException | IOException e) { System.err.printf("Exception occurred during the retrieval of ShareLib information: %s%n", e.getMessage()); } } ServerInfoCollector(final DiagOozieClient client);   }### Answer:
@Test public void testGetShareLibInfo() throws Exception { doReturn("share1\nshare2").when(mockDiagClient).listShareLib(isNull()); doReturn("share1\nshare2").when(mockDiagClient).listShareLib(anyString()); serverInfoCollector.storeShareLibInfo(testTempFolder); final File shareLibOut = new File(testTempFolder, "sharelib.txt"); assertTrue(shareLibOut.exists()); assertFileContains(shareLibOut, "share1"); }