@Test public void testConnectorStartFromMain() throws Exception { System.setProperty( Connector.PLUGIN_CLASS, io.nats.connector.plugins.test.NATSTestPlugin.class.getName()); try { Connector.main(new String[0]); } catch (Exception ex) { Assert.fail("Expected success."); } // invalid configuration, just make sure we don't crash String[] s = {"-config", "lksdfj"}; Connector.main(s); PrintWriter pw = new PrintWriter("config.props"); pw.write( Connector.PLUGIN_CLASS + "=" + io.nats.connector.plugins.test.NATSTestPlugin.class.getName()); pw.close(); System.clearProperty(Connector.PLUGIN_CLASS); // make sure we don't crash, and cover code. s[1] = "config.props"; Connector.main(s); }