@Test public void testGetClassification() throws Exception { CSVRecordInfo<CoLTaxonCsvField> record = mock(CSVRecordInfo.class); ETLStatistics etlStatistics = new ETLStatistics(); when(record.get(CoLTaxonCsvField.taxonID)).thenReturn("6931872"); when(record.get(CoLTaxonCsvField.identifier)).thenReturn("urn:lsid:catalogueoflife.org:taxon:6703cbb5-e478-11e5-86e7-bc764e092680:col20150315"); when(record.get(CoLTaxonCsvField.datasetID)).thenReturn("67"); when(record.get(CoLTaxonCsvField.datasetName)).thenReturn("ITIS Bees in Species 2000 & ITIS Catalogue of Life: 23rd March 2016"); when(record.get(CoLTaxonCsvField.acceptedNameUsageID)).thenReturn("test_acceptedNameUsageID"); when(record.get(CoLTaxonCsvField.parentNameUsageID)).thenReturn("27000241"); when(record.get(CoLTaxonCsvField.taxonomicStatus)).thenReturn("accepted name"); when(record.get(CoLTaxonCsvField.taxonRank)).thenReturn("species"); when(record.get(CoLTaxonCsvField.verbatimTaxonRank)).thenReturn("test_verbatimTaxonRank"); when(record.get(CoLTaxonCsvField.scientificName)).thenReturn("Bombus affinis Cresson, 1863"); when(record.get(CoLTaxonCsvField.kingdom)).thenReturn("Animalia"); when(record.get(CoLTaxonCsvField.phylum)).thenReturn("Arthropoda"); when(record.get(CoLTaxonCsvField.classRank)).thenReturn("Insecta"); when(record.get(CoLTaxonCsvField.family)).thenReturn("Apidae"); when(record.get(CoLTaxonCsvField.superfamily)).thenReturn("Apoidea"); when(record.get(CoLTaxonCsvField.genericName)).thenReturn("Bombus"); when(record.get(CoLTaxonCsvField.subgenus)).thenReturn("test_subgenus"); when(record.get(CoLTaxonCsvField.specificEpithet)).thenReturn("affinis"); when(record.get(CoLTaxonCsvField.infraspecificEpithet)).thenReturn("test_infraspecificEpithet"); when(record.get(CoLTaxonCsvField.scientificNameAuthorship)).thenReturn("Cresson, 1863"); when(record.get(CoLTaxonCsvField.source)).thenReturn("test_source"); when(record.get(CoLTaxonCsvField.namePublishedIn)).thenReturn("test_namePublishedIn"); when(record.get(CoLTaxonCsvField.nameAccordingTo)).thenReturn("test_nameAccordingTo"); when(record.get(CoLTaxonCsvField.modified)).thenReturn("30-Sep-2008"); when(record.get(CoLTaxonCsvField.description)).thenReturn("test_desc"); when(record.get(CoLTaxonCsvField.taxonConceptID)).thenReturn("test_taxonConceptID"); when(record.get(CoLTaxonCsvField.scientificNameID)).thenReturn("ITS-714782"); when(record.get(CoLTaxonCsvField.references)).thenReturn("https: CoLTaxonTransformer coLTaxonTransformer = new CoLTaxonTransformer(etlStatistics); CommonReflectionUtil.setField(AbstractTransformer.class, coLTaxonTransformer, "objectID", "6931872"); CommonReflectionUtil.setField(AbstractTransformer.class, coLTaxonTransformer, "input", record); Object returned = ReflectionUtil.call(coLTaxonTransformer, "getClassification", new Class[] {}, new Object[] {}); DefaultClassification defaultClassification = (DefaultClassification) returned; DefaultClassification expected = new DefaultClassification(); expected.setKingdom("Animalia"); expected.setPhylum("Arthropoda"); expected.setClassName("Insecta"); expected.setSuperFamily("Apoidea"); expected.setFamily("Apidae"); expected.setGenus("Bombus"); expected.setSubgenus("test_subgenus"); expected.setSpecificEpithet("affinis"); assertNotNull("01", returned); assertEquals("02", expected.getKingdom(), defaultClassification.getKingdom()); assertEquals("03", expected.getPhylum(), defaultClassification.getPhylum()); assertEquals("04", expected.getClassName(), defaultClassification.getClassName()); assertEquals("05", expected.getSuperFamily(), defaultClassification.getSuperFamily()); assertEquals("06", expected.getFamily(), defaultClassification.getFamily()); assertEquals("07", expected.getGenus(), defaultClassification.getGenus()); assertEquals("08", expected.getSubgenus(), defaultClassification.getSubgenus()); assertEquals("09", expected.getSpecificEpithet(), defaultClassification.getSpecificEpithet()); }
private DefaultClassification getClassification() { DefaultClassification dc = new DefaultClassification(); dc.setKingdom(input.get(kingdom)); dc.setPhylum(input.get(phylum)); dc.setClassName(input.get(classRank)); dc.setOrder(input.get(order)); dc.setSuperFamily(input.get(superfamily)); dc.setFamily(input.get(family)); dc.setGenus(input.get(genericName)); dc.setSubgenus(input.get(subgenus)); dc.setSpecificEpithet(input.get(specificEpithet)); dc.setInfraspecificEpithet(input.get(infraspecificEpithet)); return dc; }
CoLTaxonTransformer extends AbstractCSVTransformer<CoLTaxonCsvField, Taxon> { private DefaultClassification getClassification() { DefaultClassification dc = new DefaultClassification(); dc.setKingdom(input.get(kingdom)); dc.setPhylum(input.get(phylum)); dc.setClassName(input.get(classRank)); dc.setOrder(input.get(order)); dc.setSuperFamily(input.get(superfamily)); dc.setFamily(input.get(family)); dc.setGenus(input.get(genericName)); dc.setSubgenus(input.get(subgenus)); dc.setSpecificEpithet(input.get(specificEpithet)); dc.setInfraspecificEpithet(input.get(infraspecificEpithet)); return dc; } }
CoLTaxonTransformer extends AbstractCSVTransformer<CoLTaxonCsvField, Taxon> { private DefaultClassification getClassification() { DefaultClassification dc = new DefaultClassification(); dc.setKingdom(input.get(kingdom)); dc.setPhylum(input.get(phylum)); dc.setClassName(input.get(classRank)); dc.setOrder(input.get(order)); dc.setSuperFamily(input.get(superfamily)); dc.setFamily(input.get(family)); dc.setGenus(input.get(genericName)); dc.setSubgenus(input.get(subgenus)); dc.setSpecificEpithet(input.get(specificEpithet)); dc.setInfraspecificEpithet(input.get(infraspecificEpithet)); return dc; } CoLTaxonTransformer(ETLStatistics stats); }
CoLTaxonTransformer extends AbstractCSVTransformer<CoLTaxonCsvField, Taxon> { private DefaultClassification getClassification() { DefaultClassification dc = new DefaultClassification(); dc.setKingdom(input.get(kingdom)); dc.setPhylum(input.get(phylum)); dc.setClassName(input.get(classRank)); dc.setOrder(input.get(order)); dc.setSuperFamily(input.get(superfamily)); dc.setFamily(input.get(family)); dc.setGenus(input.get(genericName)); dc.setSubgenus(input.get(subgenus)); dc.setSpecificEpithet(input.get(specificEpithet)); dc.setInfraspecificEpithet(input.get(infraspecificEpithet)); return dc; } CoLTaxonTransformer(ETLStatistics stats);  }
CoLTaxonTransformer extends AbstractCSVTransformer<CoLTaxonCsvField, Taxon> { private DefaultClassification getClassification() { DefaultClassification dc = new DefaultClassification(); dc.setKingdom(input.get(kingdom)); dc.setPhylum(input.get(phylum)); dc.setClassName(input.get(classRank)); dc.setOrder(input.get(order)); dc.setSuperFamily(input.get(superfamily)); dc.setFamily(input.get(family)); dc.setGenus(input.get(genericName)); dc.setSubgenus(input.get(subgenus)); dc.setSpecificEpithet(input.get(specificEpithet)); dc.setInfraspecificEpithet(input.get(infraspecificEpithet)); return dc; } CoLTaxonTransformer(ETLStatistics stats);   }