JBBPNamedNumericFieldMap implements JBBPFieldFinder { public JBBPNumericField remove(final JBBPNamedFieldInfo nameInfo) { JBBPUtils.assertNotNull(nameInfo, "Name info must not be null"); return this.fieldMap.remove(nameInfo); } JBBPNamedNumericFieldMap();  JBBPNamedNumericFieldMap(final JBBPExternalValueProvider externalValueProvider); JBBPExternalValueProvider getExternalValueProvider(); JBBPNumericField get(final JBBPNamedFieldInfo namedField); void putField(final JBBPNumericField field); JBBPNumericField remove(final JBBPNamedFieldInfo nameInfo); JBBPNumericField findForFieldOffset(final int offset); @Override T findFirstFieldForType(final Class<T> fieldType); @Override T findLastFieldForType(final Class<T> fieldType); @Override T findFieldForType(final Class<T> fieldType); @Override T findFieldForNameAndType(final String fieldName, final Class<T> fieldType); @Override T findFieldForPathAndType(final String fieldPath, final Class<T> fieldType); @Override JBBPAbstractField findFieldForName(final String fieldName); @Override JBBPAbstractField findFieldForPath(final String fieldPath); @Override boolean nameExists(final String fieldName); @Override boolean pathExists(final String fieldPath); void clear(); boolean isEmpty(); int size(); int getExternalFieldValue(final String externalFieldName, final JBBPCompiledBlock compiledBlock, final JBBPIntegerValueEvaluator evaluator);  }
@Test public void testRemove() { final JBBPNamedNumericFieldMap map = new JBBPNamedNumericFieldMap(); final JBBPNumericField field1 = new JBBPFieldInt(new JBBPNamedFieldInfo("test.test", "test", 0), 123); final JBBPNumericField field2 = new JBBPFieldInt(new JBBPNamedFieldInfo("test.test2", "test2", 0), 123); final JBBPNumericField field3 = new JBBPFieldByte(new JBBPNamedFieldInfo("test.test3", "test3", 0), (byte) 123); map.putField(field1); map.putField(field2); map.putField(field3); assertEquals(3, map.size()); map.remove(field2.getNameInfo()); assertEquals(2, map.size()); assertSame(field1, map.findFieldForName("test")); assertSame(field3, map.findFieldForName("test3")); assertNull(map.findFieldForName("test2")); try { map.remove(null); fail("Must throw NPE"); } catch (NullPointerException ex) { } }