### Question:
MUXPool extends QBeanSupport implements MUX, MUXPoolMBean { public void initService () throws ConfigurationException { Element e = getPersist (); muxName = toStringArray(e.getChildTextTrim ("muxes")); strategy = getStrategy(e.getChildTextTrim("strategy")); overrideMTIs = toStringArray(e.getChildTextTrim("follower-override")); originalChannelField = e.getChildTextTrim("original-channel-field"); splitField = e.getChildTextTrim("split-field"); checkEnabled = cfg.getBoolean("check-enabled"); sp = grabSpace (e.getChild ("space")); mux = new MUX[muxName.length]; try { for (int i=0; i<mux.length; i++) mux[i] = QMUX.getMUX (muxName[i]); } catch (NameRegistrar.NotFoundException ex) { throw new ConfigurationException (ex); } NameRegistrar.register ("mux."+getName (), this); }  void initService(); void stopService(); ISOMsg request(ISOMsg m, long timeout); void send(ISOMsg m); boolean isConnected(); void request(ISOMsg m, long timeout, final ISOResponseListener r, final Object handBack); @Override String[] getMuxNames(); @Override int getStrategy(); static final int ROUND_ROBIN; static final int PRIMARY_SECONDARY; static final int ROUND_ROBIN_WITH_OVERRIDE; static final int SPLIT_BY_DIVISOR; }### Answer:
@Test public void testInitServiceThrowsNullPointerException() throws Throwable { MUXPool mUXPool = new MUXPool(); try { mUXPool.initService(); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"org.jdom2.Element.getChildTextTrim(String)\" because \"e\" is null", ex.getMessage(), "ex.getMessage()"); } assertFalse(mUXPool.isModified(), "mUXPool.isModified()"); assertNull(mUXPool.muxName, "mUXPool.muxName"); assertNull(mUXPool.mux, "mUXPool.mux"); assertEquals(0, mUXPool.strategy, "mUXPool.strategy"); } }
@Test public void testInitServiceThrowsNullPointerException1() throws Throwable { MUXPool mUXPool = new MUXPool(); mUXPool.setPersist(new Element("testMUXPoolName", "testMUXPoolUri")); try { mUXPool.initService(); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"org.jpos.core.Configuration.getBoolean(String)\" because \"this.cfg\" is null", ex.getMessage(), "ex.getMessage()"); } assertNull(mUXPool.mux, "mUXPool.mux"); assertFalse(mUXPool.isModified(), "mUXPool.isModified()"); assertEquals(0, mUXPool.strategy, "mUXPool.strategy"); assertNull(mUXPool.muxName, "mUXPool.muxName"); } }