### Question:
CommandLineParser { public String getDetailedUsage() throws TransformerException, IOException { try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream is = getClass().getResourceAsStream("detailedUsage.xsl")) { toolspec.transform(is, baos); return baos.toString(); } } CommandLineParser(ToolSpec ts); void setToolSpec(ToolSpec ts); static String[] getArgsFromString(String s); CommandDocument parseArguments(String args); CommandDocument parseArguments(String[] args); void throwUsage(ErrorVisitor errors); String getUsage(); String getDetailedUsage(); String getFormattedDetailedUsage(); String getDetailedUsage(String id); String getToolUsage();  }### Answer:
@Test public void testDetailedUsage() throws Exception { String specialItem = "[ -p <[wsdl namespace =]Package Name> ]*"; if (!isQuolifiedVersion()) { specialItem = "-p <[wsdl namespace =]Package Name>*"; } String[] expected = new String[]{"[ -n <C++ Namespace> ]", "Namespace", "[ -impl ]", "impl - the impl that will be used by this tool to do " + "whatever it is this tool does.", "[ -e <Enum Value> ]", "enum", "-r", "required", specialItem, "The java package name to use for the generated code." + "Also, optionally specify the wsdl namespace mapping to " + "a particular java packagename.", "[ -? ]", "help", "[ -v ]", "version", "<wsdlurl>", "WSDL/SCHEMA URL"}; int index = 0; String lineSeparator = System.getProperty("line.separator"); StringTokenizer st1 = new StringTokenizer(parser.getDetailedUsage(), lineSeparator); while (st1.hasMoreTokens()) { assertEquals("Failed at line " + index, expected[index++], st1.nextToken().toString().trim()); } }
@Test public void testGetDetailedUsage() { assertEquals("Namespace", parser.getDetailedUsage("namespace")); }