### Question:
MongoFieldMapping { private static void add(Class<? extends Annotation> class1, String shortName, String... fieldMappings) { checkArgument(fieldMappings.length % 2 == 0, "even nr of field mappings! " + fieldMappings.length); for (MongoFieldMapping mfm : ALL_MAPPINGS.values()) { checkArgument(!mfm.shortName.equals(shortName), "duplicate shortname! " + shortName); } checkArgument(!shortName.equals(FILTER), FILTER + " shortname reserved"); MongoFieldMapping mfm = new MongoFieldMapping(shortName); for (int i = 0; i < fieldMappings.length; i = i + 2) { mfm.add(fieldMappings[i], fieldMappings[i + 1]); } ALL_MAPPINGS.put(class1.getName(), mfm); } MongoFieldMapping(String shortName); MongoFieldMapping add(String fieldName, String shortFieldName); static void readFieldFromDb(String fieldKey, String range,
            Annotation a, Feature f, BasicDBObject dbO, JCas jCas); static final String ID; static final String PM_ID; static final String BEGIN; static final String END; static final String TITLE; static final String TEXT; static final String FILTER; static final Map<String, MongoFieldMapping> ALL_MAPPINGS; final static Set<String> ALL_MAPPINGS_KEYS; final String shortName; final Map<String, String> fieldMappings; }### Answer:
@Test public void test() throws Exception { JCas jCas = UimaTests.getTokenizedTestCas(); DataTable dt = new DataTable(jCas); dt.setTableId(12); dt.setPageNumber(13); StringArray sa = new StringArray(jCas, 4); sa.copyFromArray(new String[] { "one", "two", "t", "f" }, 0, 0, 4); dt.setBody(sa); dt.addToIndexes(); Header h = new Header(jCas); h.setDocId("117"); h.addToIndexes(); LOG.debug("done creating jCas"); JcasPipelineBuilder p = new JcasPipelineBuilder(jCas); p.add(MongoWriter.class, BlueUima.PARAM_DB_CONNECTION, conn); p.process(); LOG.debug("done storing in db"); List<JCas> l = asList(createReader( MongoCollectionReader.class, BlueUima.PARAM_DB_CONNECTION, conn)); assertEquals(1, l.size()); jCas = l.get(0); assertEquals(UimaTests.TEST_SENTENCE, jCas.getDocumentText()); h = selectSingle(jCas, Header.class); assertNotNull(h); assertEquals("117", h.getDocId()); dt = selectSingle(jCas, DataTable.class); assertNotNull(dt); assertEquals(12, dt.getTableId()); StringArray body = dt.getBody(); assertEquals(4, body.size()); assertEquals("one", body.get(0)); assertEquals("f", body.get(3)); LOG.debug("done done"); }