@Test public void testGetDefaultClassification() { String expectedGenus = "Rhododendron"; String expectedFamilyname = "Plantae"; @SuppressWarnings("unchecked") CSVRecordInfo<BrahmsCsvField> record = mock(CSVRecordInfo.class); when(record.get(SPECIES)).thenReturn(null); when(record.get(AUTHOR2)).thenReturn("L."); when(record.get(GENUS)).thenReturn("Rhododendron"); when(record.get(SP1)).thenReturn("ferrugineum"); when(record.get(RANK2)).thenReturn(""); when(record.get(SP2)).thenReturn(""); ScientificName scientificName = new ScientificName(); scientificName.setFullScientificName("Rhododendron ferrugineum (L.)"); scientificName.setAuthorshipVerbatim("L."); scientificName.setGenusOrMonomial("Rhododendron"); scientificName.setSpecificEpithet("ferrugineum"); scientificName.setScientificNameGroup("rhododendron ferrugineum "); scientificName.setInfraspecificMarker(""); scientificName.setInfraspecificEpithet(""); DefaultClassification classification = BrahmsImportUtil.getDefaultClassification(record, scientificName); assertNotNull("01",classification); assertEquals("02",expectedGenus, classification.getGenus()); assertEquals("03",expectedFamilyname, classification.getKingdom()); }
public static DefaultClassification getDefaultClassification(CSVRecordInfo<BrahmsCsvField> record, ScientificName sn) { DefaultClassification dc = TransformUtil.extractClassificiationFromName(sn); boolean fungus = false; String famClass = record.get(FAMCLASS); if (famClass != null && famClass.toLowerCase().equals("fungi")) { fungus = true; } dc.setKingdom("Plantae"); if (fungus) { dc.setKingdom("Fungi"); } if (!fungus) dc.setClassName(record.get(FAMCLASS)); dc.setOrder(record.get(ORDER)); if (!fungus) { dc.setFamily(record.get(FAMILY)); } else { String prefix = "(?i)(fungi-)"; String familyName = record.get(FAMILY); if (familyName.matches(prefix)) dc.setFamily(familyName.replaceFirst(prefix, "")); } return dc; }
BrahmsImportUtil { public static DefaultClassification getDefaultClassification(CSVRecordInfo<BrahmsCsvField> record, ScientificName sn) { DefaultClassification dc = TransformUtil.extractClassificiationFromName(sn); boolean fungus = false; String famClass = record.get(FAMCLASS); if (famClass != null && famClass.toLowerCase().equals("fungi")) { fungus = true; } dc.setKingdom("Plantae"); if (fungus) { dc.setKingdom("Fungi"); } if (!fungus) dc.setClassName(record.get(FAMCLASS)); dc.setOrder(record.get(ORDER)); if (!fungus) { dc.setFamily(record.get(FAMILY)); } else { String prefix = "(?i)(fungi-)"; String familyName = record.get(FAMILY); if (familyName.matches(prefix)) dc.setFamily(familyName.replaceFirst(prefix, "")); } return dc; } }
BrahmsImportUtil { public static DefaultClassification getDefaultClassification(CSVRecordInfo<BrahmsCsvField> record, ScientificName sn) { DefaultClassification dc = TransformUtil.extractClassificiationFromName(sn); boolean fungus = false; String famClass = record.get(FAMCLASS); if (famClass != null && famClass.toLowerCase().equals("fungi")) { fungus = true; } dc.setKingdom("Plantae"); if (fungus) { dc.setKingdom("Fungi"); } if (!fungus) dc.setClassName(record.get(FAMCLASS)); dc.setOrder(record.get(ORDER)); if (!fungus) { dc.setFamily(record.get(FAMILY)); } else { String prefix = "(?i)(fungi-)"; String familyName = record.get(FAMILY); if (familyName.matches(prefix)) dc.setFamily(familyName.replaceFirst(prefix, "")); } return dc; } BrahmsImportUtil(); }
BrahmsImportUtil { public static DefaultClassification getDefaultClassification(CSVRecordInfo<BrahmsCsvField> record, ScientificName sn) { DefaultClassification dc = TransformUtil.extractClassificiationFromName(sn); boolean fungus = false; String famClass = record.get(FAMCLASS); if (famClass != null && famClass.toLowerCase().equals("fungi")) { fungus = true; } dc.setKingdom("Plantae"); if (fungus) { dc.setKingdom("Fungi"); } if (!fungus) dc.setClassName(record.get(FAMCLASS)); dc.setOrder(record.get(ORDER)); if (!fungus) { dc.setFamily(record.get(FAMILY)); } else { String prefix = "(?i)(fungi-)"; String familyName = record.get(FAMILY); if (familyName.matches(prefix)) dc.setFamily(familyName.replaceFirst(prefix, "")); } return dc; } BrahmsImportUtil(); static File[] getCsvFiles(); static void backup(); static void removeBackupExtension(); static ScientificName getScientificName(CSVRecordInfo<BrahmsCsvField> record); static DefaultClassification getDefaultClassification(CSVRecordInfo<BrahmsCsvField> record,
			ScientificName sn); static List<Monomial> getSystemClassification(DefaultClassification dc); static String getAuthor(CSVRecordInfo<BrahmsCsvField> record); static String getInfraspecificMarker(CSVRecordInfo<BrahmsCsvField> record); static String getInfraspecificEpithet(CSVRecordInfo<BrahmsCsvField> record); static String getTaxonRank(CSVRecordInfo<BrahmsCsvField> record); static File getDataDir(); }
BrahmsImportUtil { public static DefaultClassification getDefaultClassification(CSVRecordInfo<BrahmsCsvField> record, ScientificName sn) { DefaultClassification dc = TransformUtil.extractClassificiationFromName(sn); boolean fungus = false; String famClass = record.get(FAMCLASS); if (famClass != null && famClass.toLowerCase().equals("fungi")) { fungus = true; } dc.setKingdom("Plantae"); if (fungus) { dc.setKingdom("Fungi"); } if (!fungus) dc.setClassName(record.get(FAMCLASS)); dc.setOrder(record.get(ORDER)); if (!fungus) { dc.setFamily(record.get(FAMILY)); } else { String prefix = "(?i)(fungi-)"; String familyName = record.get(FAMILY); if (familyName.matches(prefix)) dc.setFamily(familyName.replaceFirst(prefix, "")); } return dc; } BrahmsImportUtil(); static File[] getCsvFiles(); static void backup(); static void removeBackupExtension(); static ScientificName getScientificName(CSVRecordInfo<BrahmsCsvField> record); static DefaultClassification getDefaultClassification(CSVRecordInfo<BrahmsCsvField> record,
			ScientificName sn); static List<Monomial> getSystemClassification(DefaultClassification dc); static String getAuthor(CSVRecordInfo<BrahmsCsvField> record); static String getInfraspecificMarker(CSVRecordInfo<BrahmsCsvField> record); static String getInfraspecificEpithet(CSVRecordInfo<BrahmsCsvField> record); static String getTaxonRank(CSVRecordInfo<BrahmsCsvField> record); static File getDataDir();  }