### Question:
MD5Filter implements ISOFilter, Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { key = cfg.get ("key"); String fieldList = cfg.get ("fields"); if (fieldList == null) throw new ConfigurationException ("'fields' property not present"); StringTokenizer st = new StringTokenizer (fieldList); int f[] = new int[st.countTokens()]; for (int i=0; i<f.length; i++) f[i] = Integer.parseInt (st.nextToken()); fields = f; } MD5Filter(); void setConfiguration(Configuration cfg); void setFields(int[] fields); int[] getFields(ISOMsg m); ISOMsg filter(ISOChannel channel, ISOMsg m, LogEvent evt);  }### Answer:
@Test public void testSetConfiguration() throws Throwable { MD5Filter mD5Filter = new MD5Filter(); mD5Filter.setConfiguration(new SimpleConfiguration()); assertEquals("", mD5Filter.key, "mD5Filter.key"); assertEquals(0, mD5Filter.fields.length, "mD5Filter.fields.length"); }
@Test public void testSetConfigurationThrowsNullPointerException() throws Throwable { MD5Filter mD5Filter = new MD5Filter(); Configuration cfg = new SubConfiguration(); try { mD5Filter.setConfiguration(cfg); 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.get(String)\" because \"this.cfg\" is null", ex.getMessage(), "ex.getMessage()"); } assertNull(mD5Filter.key, "mD5Filter.key"); assertNull(mD5Filter.fields, "mD5Filter.fields"); } }