OpenLibertyGenerator extends JavaExecGenerator { @Override protected List<String> extractPorts() { List<String> ret = new ArrayList<>(); addPortIfValid(ret, getConfig(JavaExecGenerator.Config.webPort, "9080")); addPortIfValid(ret, getConfig(JavaExecGenerator.Config.jolokiaPort)); addPortIfValid(ret, getConfig(JavaExecGenerator.Config.prometheusPort)); return ret; } OpenLibertyGenerator(GeneratorContext context); @Override boolean isApplicable(List<ImageConfiguration> configs);  }
@Test public void testExtractPorts() throws IOException, MojoExecutionException { OpenLibertyGenerator generator = new OpenLibertyGenerator(createGeneratorContext()); List<String> ports = generator.extractPorts(); assertNotNull(ports); assertTrue("The list of ports should contain 9080", ports.contains("9080")); }