MapperFieldCopy extends Mapper { @Override public boolean init(String inputDesc, String fieldName, String mapClassCode, Object mapConfigs) { init(inputDesc, fieldName, mapClassCode); if (!(mapConfigs instanceof Map)) { LOG.fatal("Can't initialize object. mapConfigs class is not of type Map. " + mapConfigs.getClass().getName()); return false; } @SuppressWarnings("unchecked") Map<String, Object> mapObjects = (Map<String, Object>) mapConfigs; copyName = (String) mapObjects.get("copy_name"); if (StringUtils.isEmpty(copyName)) { LOG.fatal("Map copy name is empty."); return false; } return true; }  @Override boolean init(String inputDesc, String fieldName, String mapClassCode, Object mapConfigs); @Override Object apply(Map<String, Object> jsonObj, Object value);  }
@Test public void testMapperFielCopy_configNotMap() { LOG.info("testMapperFieldCopy_configNotMap()"); MapperFieldCopy mapperFieldCopy = new MapperFieldCopy(); assertFalse("Was able to initialize!", mapperFieldCopy.init(null, "someField", null, "")); }
@Test public void testMapperFieldCopy_noNewFieldName() { LOG.info("testMapperFieldCopy_noNewFieldName()"); Map<String, Object> mapConfigs = new HashMap<>(); MapperFieldCopy mapperFieldCopy = new MapperFieldCopy(); assertFalse("Was able to initialize!", mapperFieldCopy.init(null, "someField", null, mapConfigs)); }