GetOpenApiDocAction extends EndpointsToolAction { @Override public boolean execute() throws ClassNotFoundException, IOException, ApiConfigException { String warPath = getWarPath(warOption); List<String> serviceClassNames = getServiceClassNames(warPath); if (serviceClassNames.isEmpty()) { return false; } genOpenApiDoc(computeClassPath(warPath, getClassPath(classPathOption)), getOpenApiOutputPath(outputOption), getHostname(hostnameOption, warPath), getBasePath(basePathOption), serviceClassNames, true); return true; } GetOpenApiDocAction(); protected  GetOpenApiDocAction(String alias, boolean displayHelp); @Override String getUsageString(); @Override boolean execute(); String genOpenApiDoc(
      URL[] classPath, String outputFilePath, String hostname, String basePath,
      List<String> serviceClassNames, boolean outputToDisk); static final String NAME; static final String LEGACY_NAME; }
@Test public void testGetOpenApiDoc() throws Exception { tool.execute( new String[]{GetOpenApiDocAction.NAME, option(EndpointsToolAction.OPTION_CLASS_PATH_SHORT), "classPath", option(EndpointsToolAction.OPTION_OUTPUT_DIR_SHORT), "outputDir", "MyService", "MyService2"}); assertFalse(usagePrinted); assertThat(Lists.newArrayList(classPath)) .containsExactly(new File("classPath").toURI().toURL(), new File(new File(EndpointsToolAction.DEFAULT_WAR_PATH).getAbsoluteFile(), "/WEB-INF/classes") .toURI() .toURL()); assertEquals("outputDir", outputFilePath); assertEquals(EndpointsToolAction.DEFAULT_BASE_PATH, basePath); assertStringsEqual(Arrays.asList("MyService", "MyService2"), serviceClassNames); assertTrue(outputToDisk); }