### Question:
ToolWrapper { public static void main(String[] args) throws GeneratorException { CommandLineParser cmdParser = new PosixParser(); try { CommandLine cmd = cmdParser.parse(OPTIONS, args); if ((args.length == 0) || (cmd.hasOption(HELP_OPT))) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(Constants.PROJECT_NAME, OPTIONS, true); if (args.length == 0) logger.info("Reading default configuration files from working " + "directory ..."); else System.exit(0); } String toolspecPath = cmd.getOptionValue(TOOLSPEC_OPT, Constants.DEFAULT_TOOLSPEC); File toolspecFile = new File(toolspecPath); String propertiesPath = cmd.getOptionValue(PROPERTIES_OPT, Constants.DEFAULT_PROJECT_PROPERTIES); File propertiesFile = new File(propertiesPath); ioc.setXmlConf(toolspecFile); ioc.setProjConf(propertiesFile); } catch (Exception excep) { logger.error("Problem parsing command line arguments.", excep); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(Constants.PROJECT_NAME, OPTIONS, true); throw new GeneratorException("Problem parsing command line arguments"); } if (!ioc.hasConfig()) { throw new GeneratorException("No configuration available."); } JAXBContext context; try { context = JAXBContext .newInstance("eu.impact_project.iif.tw.toolspec"); Unmarshaller unmarshaller = context.createUnmarshaller(); Toolspec toolspec = (Toolspec) unmarshaller.unmarshal(new File(ioc .getXmlConf())); logger.info("Toolspec model: " + toolspec.getModel()); logger.info("Tool id: " + toolspec.getId()); logger.info("Tool name: " + toolspec.getName()); logger.info("Tool version: " + toolspec.getVersion()); List<Service> services = toolspec.getServices().getService(); for (Service service : services) { createService(service, toolspec.getVersion()); } } catch (IOException ex) { logger.error("An IOException occurred", ex); } catch (JAXBException ex) { logger.error("JAXBException", ex); throw new GeneratorException( "Unable to create XML binding for toolspec"); } }  static void main(String[] args);  }### Answer:
@Test public void testMain() throws Exception { System.out.println("main"); String[] args = new String[0]; ToolWrapper.main(args); }
@Test public void testMainFail() { String[] args = new String[1]; args[0]="-i"; try { ToolWrapper.main(args); fail("Should raise exception"); } catch (Exception ex) { } }