@Test public void testStartServiceThrowsNullPointerException() throws Throwable { UI uI = new UI(); uI.setPersist(new Element("testUIName", "testUIPrefix", "testUIUri")); try { uI.startService(); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"org.jpos.q2.Q2.getFactory()\" because the return value of \"org.jpos.q2.QBeanSupport.getServer()\" is null", ex.getMessage(), "ex.getMessage()"); } assertFalse(uI.isModified(), "uI.isModified()"); assertNull(uI.ui, "uI.ui"); } }
public void startService () throws Exception { Element config = getPersist (); String provider = config.getAttributeValue ("provider", "org.jpos.ui.UI"); ui = (org.jpos.ui.UI) getFactory().newInstance (provider); ui.setConfig (config); ui.setLog (getLog ()); ui.setObjectFactory (this); ui.configure (); NameRegistrar.register (getName(), ui); }
UI extends QBeanSupport implements UIObjectFactory { public void startService () throws Exception { Element config = getPersist (); String provider = config.getAttributeValue ("provider", "org.jpos.ui.UI"); ui = (org.jpos.ui.UI) getFactory().newInstance (provider); ui.setConfig (config); ui.setLog (getLog ()); ui.setObjectFactory (this); ui.configure (); NameRegistrar.register (getName(), ui); } }
UI extends QBeanSupport implements UIObjectFactory { public void startService () throws Exception { Element config = getPersist (); String provider = config.getAttributeValue ("provider", "org.jpos.ui.UI"); ui = (org.jpos.ui.UI) getFactory().newInstance (provider); ui.setConfig (config); ui.setLog (getLog ()); ui.setObjectFactory (this); ui.configure (); NameRegistrar.register (getName(), ui); } UI(); }
UI extends QBeanSupport implements UIObjectFactory { public void startService () throws Exception { Element config = getPersist (); String provider = config.getAttributeValue ("provider", "org.jpos.ui.UI"); ui = (org.jpos.ui.UI) getFactory().newInstance (provider); ui.setConfig (config); ui.setLog (getLog ()); ui.setObjectFactory (this); ui.configure (); NameRegistrar.register (getName(), ui); } UI(); void startService(); void stopService(); Object newInstance(String clazz); }
UI extends QBeanSupport implements UIObjectFactory { public void startService () throws Exception { Element config = getPersist (); String provider = config.getAttributeValue ("provider", "org.jpos.ui.UI"); ui = (org.jpos.ui.UI) getFactory().newInstance (provider); ui.setConfig (config); ui.setLog (getLog ()); ui.setObjectFactory (this); ui.configure (); NameRegistrar.register (getName(), ui); } UI(); void startService(); void stopService(); Object newInstance(String clazz);  }