@Test public void testGetSpecimenIdentification() throws Exception { CSVRecordInfo<BrahmsCsvField> record = mock(CSVRecordInfo.class); ETLStatistics etlStatistics = new ETLStatistics(); when(record.get(BrahmsCsvField.SPECIES)).thenReturn("Rhododendron ferrugineum L."); when(record.get(BrahmsCsvField.AUTHOR2)).thenReturn("L."); when(record.get(BrahmsCsvField.GENUS)).thenReturn("Rhododendron"); when(record.get(BrahmsCsvField.SP1)).thenReturn("ferrugineum"); when(record.get(BrahmsCsvField.RANK2)).thenReturn("testInfraSpecifc"); when(record.get(BrahmsCsvField.SP2)).thenReturn(""); when(record.get(BrahmsCsvField.BARCODE)).thenReturn("L.3355550"); when(record.get(BrahmsCsvField.NOTONLINE)).thenReturn(""); when(record.get(BrahmsCsvField.PLANTDESC)).thenReturn("TestDesc"); when(record.get(BrahmsCsvField.CATEGORY)).thenReturn("L"); when(record.get(BrahmsCsvField.COLLECTOR, false)).thenReturn("Unknown "); when(record.get(BrahmsCsvField.PREFIX, false)).thenReturn(" "); when(record.get(BrahmsCsvField.NUMBER, false)).thenReturn("s.n. "); when(record.get(BrahmsCsvField.SUFFIX, false)).thenReturn(" "); when(record.get(BrahmsCsvField.TYPE)).thenReturn(""); when(record.get(BrahmsCsvField.DETBY)).thenReturn(""); when(record.get(BrahmsCsvField.VERNACULAR)).thenReturn(""); when(record.get(BrahmsCsvField.YEARIDENT)).thenReturn(" 0.000000"); when(record.get(BrahmsCsvField.MONTHIDENT)).thenReturn(" 0.000000"); when(record.get(BrahmsCsvField.DAYIDENT)).thenReturn(" 0.000000"); when(record.get(BrahmsCsvField.IMAGELIST)).thenReturn("http: when(record.get(BrahmsCsvField.CONTINENT)).thenReturn("Europe"); when(record.get(BrahmsCsvField.COUNTRY)).thenReturn("Netherlands"); when(record.get(BrahmsCsvField.MAJORAREA)).thenReturn(""); when(record.get(BrahmsCsvField.LOCNOTES)).thenReturn("Io een rotsachtige rij vochtige berghelling bij het Kolmhans."); when(record.get(BrahmsCsvField.YEAR)).thenReturn(" 0.000000"); when(record.get(BrahmsCsvField.MONTH)).thenReturn(" 8.000000"); when(record.get(BrahmsCsvField.DAY)).thenReturn(" 3.000000"); when(record.get(BrahmsCsvField.LATITUDE)).thenReturn(" 0.000000"); when(record.get(BrahmsCsvField.LONGITUDE)).thenReturn(" 0.000000"); BrahmsSpecimenTransformer brahmsSpecimenTransformer = new BrahmsSpecimenTransformer(etlStatistics); CommonReflectionUtil.setField(AbstractTransformer.class, brahmsSpecimenTransformer, "objectID", "L.3355550"); CommonReflectionUtil.setField(AbstractTransformer.class, brahmsSpecimenTransformer, "input", record); Object obj = CommonReflectionUtil.callMethod(record, CSVRecordInfo.class, brahmsSpecimenTransformer, "getSpecimenIdentification"); SpecimenIdentification identification = (SpecimenIdentification) obj; String expectedGenus = "Rhododendron"; String expectedKingdom = "Plantae"; String expectedSpecificEpithet = "ferrugineum"; assertNotNull("01",identification); assertEquals("02",expectedGenus, identification.getDefaultClassification().getGenus()); assertEquals("03",expectedSpecificEpithet, identification.getDefaultClassification().getSpecificEpithet()); assertEquals(expectedKingdom, identification.getDefaultClassification().getKingdom()); }
private SpecimenIdentification getSpecimenIdentification(CSVRecordInfo<BrahmsCsvField> record) { SpecimenIdentification identification = new SpecimenIdentification(); identification.setTypeStatus(getTypeStatus()); String s = record.get(DETBY); if (s != null) identification.addIdentifier(new Agent(s)); s = record.get(VERNACULAR); if (s != null) identification.setVernacularNames(Arrays.asList(new VernacularName(s))); String y = record.get(YEARIDENT); String m = record.get(MONTHIDENT); String d = record.get(DAYIDENT); identification.setDateIdentified(getDate(y, m, d)); ScientificName sn = getScientificName(record); DefaultClassification dc = getDefaultClassification(record, sn); identification.setTaxonRank(getTaxonRank(record)); identification.setScientificName(sn); identification.setDefaultClassification(dc); return identification; }
BrahmsSpecimenTransformer extends BrahmsTransformer<Specimen> { private SpecimenIdentification getSpecimenIdentification(CSVRecordInfo<BrahmsCsvField> record) { SpecimenIdentification identification = new SpecimenIdentification(); identification.setTypeStatus(getTypeStatus()); String s = record.get(DETBY); if (s != null) identification.addIdentifier(new Agent(s)); s = record.get(VERNACULAR); if (s != null) identification.setVernacularNames(Arrays.asList(new VernacularName(s))); String y = record.get(YEARIDENT); String m = record.get(MONTHIDENT); String d = record.get(DAYIDENT); identification.setDateIdentified(getDate(y, m, d)); ScientificName sn = getScientificName(record); DefaultClassification dc = getDefaultClassification(record, sn); identification.setTaxonRank(getTaxonRank(record)); identification.setScientificName(sn); identification.setDefaultClassification(dc); return identification; } }
BrahmsSpecimenTransformer extends BrahmsTransformer<Specimen> { private SpecimenIdentification getSpecimenIdentification(CSVRecordInfo<BrahmsCsvField> record) { SpecimenIdentification identification = new SpecimenIdentification(); identification.setTypeStatus(getTypeStatus()); String s = record.get(DETBY); if (s != null) identification.addIdentifier(new Agent(s)); s = record.get(VERNACULAR); if (s != null) identification.setVernacularNames(Arrays.asList(new VernacularName(s))); String y = record.get(YEARIDENT); String m = record.get(MONTHIDENT); String d = record.get(DAYIDENT); identification.setDateIdentified(getDate(y, m, d)); ScientificName sn = getScientificName(record); DefaultClassification dc = getDefaultClassification(record, sn); identification.setTaxonRank(getTaxonRank(record)); identification.setScientificName(sn); identification.setDefaultClassification(dc); return identification; } BrahmsSpecimenTransformer(ETLStatistics stats); }
BrahmsSpecimenTransformer extends BrahmsTransformer<Specimen> { private SpecimenIdentification getSpecimenIdentification(CSVRecordInfo<BrahmsCsvField> record) { SpecimenIdentification identification = new SpecimenIdentification(); identification.setTypeStatus(getTypeStatus()); String s = record.get(DETBY); if (s != null) identification.addIdentifier(new Agent(s)); s = record.get(VERNACULAR); if (s != null) identification.setVernacularNames(Arrays.asList(new VernacularName(s))); String y = record.get(YEARIDENT); String m = record.get(MONTHIDENT); String d = record.get(DAYIDENT); identification.setDateIdentified(getDate(y, m, d)); ScientificName sn = getScientificName(record); DefaultClassification dc = getDefaultClassification(record, sn); identification.setTaxonRank(getTaxonRank(record)); identification.setScientificName(sn); identification.setDefaultClassification(dc); return identification; } BrahmsSpecimenTransformer(ETLStatistics stats);  }
BrahmsSpecimenTransformer extends BrahmsTransformer<Specimen> { private SpecimenIdentification getSpecimenIdentification(CSVRecordInfo<BrahmsCsvField> record) { SpecimenIdentification identification = new SpecimenIdentification(); identification.setTypeStatus(getTypeStatus()); String s = record.get(DETBY); if (s != null) identification.addIdentifier(new Agent(s)); s = record.get(VERNACULAR); if (s != null) identification.setVernacularNames(Arrays.asList(new VernacularName(s))); String y = record.get(YEARIDENT); String m = record.get(MONTHIDENT); String d = record.get(DAYIDENT); identification.setDateIdentified(getDate(y, m, d)); ScientificName sn = getScientificName(record); DefaultClassification dc = getDefaultClassification(record, sn); identification.setTaxonRank(getTaxonRank(record)); identification.setScientificName(sn); identification.setDefaultClassification(dc); return identification; } BrahmsSpecimenTransformer(ETLStatistics stats);   }