@Test public void testGetSex() throws Exception { ETLStatistics etlStatistics = new ETLStatistics(); String sex = null; CrsMultiMediaTransformer crsMultiMediaTransformer = new CrsMultiMediaTransformer(etlStatistics); CrsExtractor extractor = new CrsExtractor(multimediaFile, etlStatistics); for (XMLRecordInfo extracted : extractor) { CommonReflectionUtil.setField(AbstractTransformer.class, crsMultiMediaTransformer, "objectID", "RMNH.INS.867435"); CommonReflectionUtil.setField(AbstractTransformer.class, crsMultiMediaTransformer, "input", extracted); Element oaiDcElem = getDescendant(extracted.getRecord(), "oai_dc:dc"); List<Element> ncrsdatagroup = getDescendants(oaiDcElem, "ncrsdatagroup"); for (Element element : ncrsdatagroup) { Object obj = ReflectionUtil.call(crsMultiMediaTransformer, "getSex", new Class[] {Element.class}, new Object[] {element}); sex = (String) obj; } } String expectedSex = "male"; assertNotNull("01", expectedSex); assertEquals("02", expectedSex, sex); }
private String getSex(Element oaiDcElem) { String raw = val(oaiDcElem, "dwc:sex"); if (raw == null) { return null; } String result = sexNormalizer.normalize(raw); if (result == NOT_MAPPED) { if (logger.isDebugEnabled()) { debug("Ignoring rogue value for Sex: " + raw); } return null; } return result; }
CrsMultiMediaTransformer extends AbstractXMLTransformer<MultiMediaObject> { private String getSex(Element oaiDcElem) { String raw = val(oaiDcElem, "dwc:sex"); if (raw == null) { return null; } String result = sexNormalizer.normalize(raw); if (result == NOT_MAPPED) { if (logger.isDebugEnabled()) { debug("Ignoring rogue value for Sex: " + raw); } return null; } return result; } }
CrsMultiMediaTransformer extends AbstractXMLTransformer<MultiMediaObject> { private String getSex(Element oaiDcElem) { String raw = val(oaiDcElem, "dwc:sex"); if (raw == null) { return null; } String result = sexNormalizer.normalize(raw); if (result == NOT_MAPPED) { if (logger.isDebugEnabled()) { debug("Ignoring rogue value for Sex: " + raw); } return null; } return result; } CrsMultiMediaTransformer(ETLStatistics stats); }
CrsMultiMediaTransformer extends AbstractXMLTransformer<MultiMediaObject> { private String getSex(Element oaiDcElem) { String raw = val(oaiDcElem, "dwc:sex"); if (raw == null) { return null; } String result = sexNormalizer.normalize(raw); if (result == NOT_MAPPED) { if (logger.isDebugEnabled()) { debug("Ignoring rogue value for Sex: " + raw); } return null; } return result; } CrsMultiMediaTransformer(ETLStatistics stats);  }
CrsMultiMediaTransformer extends AbstractXMLTransformer<MultiMediaObject> { private String getSex(Element oaiDcElem) { String raw = val(oaiDcElem, "dwc:sex"); if (raw == null) { return null; } String result = sexNormalizer.normalize(raw); if (result == NOT_MAPPED) { if (logger.isDebugEnabled()) { debug("Ignoring rogue value for Sex: " + raw); } return null; } return result; } CrsMultiMediaTransformer(ETLStatistics stats);   }