### Question:
GenericPackager extends ISOBasePackager implements Configurable { @Override protected ISOFieldPackager getBitMapfieldPackager() { return fld[bitmapField]; } GenericPackager();  GenericPackager(String filename);  GenericPackager(InputStream input); void setConfiguration(Configuration cfg); void readFile(String filename); void readFile(InputStream input); @Override void setLogger(Logger logger, String realm); @Override String getDescription();  }### Answer:
@Test public void testGetBitMapfieldPackager() throws Throwable { ISOFieldPackager iFA_AMOUNT = new IFA_AMOUNT(); ISOFieldPackager[] fld = new ISOFieldPackager[2]; fld[1] = iFA_AMOUNT; GenericPackager genericPackager = new GenericPackager(); genericPackager.setFieldPackager(fld); ISOFieldPackager result = genericPackager.getBitMapfieldPackager(); assertSame(iFA_AMOUNT, result, "result"); }
@Test public void testGetBitMapfieldPackagerThrowsArrayIndexOutOfBoundsException() throws Throwable { ISOFieldPackager[] fld = new ISOFieldPackager[0]; GenericPackager genericPackager = new GenericPackager(); genericPackager.setFieldPackager(fld); try { genericPackager.getBitMapfieldPackager(); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { if (isJavaVersionAtMost(JAVA_10)) { assertEquals("1", ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Index 1 out of bounds for length 0", ex.getMessage(), "ex.getMessage()"); } } }
@Test public void testGetBitMapfieldPackagerThrowsNullPointerException() throws Throwable { GenericPackager genericPackager = new GenericPackager(); try { genericPackager.getBitMapfieldPackager(); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot load from object array because \"this.fld\" is null", ex.getMessage(), "ex.getMessage()"); } } }