@Test public void testGetScientificName_01() { @SuppressWarnings("unchecked") CSVRecordInfo<BrahmsCsvField> record = mock(CSVRecordInfo.class); when(record.get(SPECIES)).thenReturn("Rhododendron ferrugineum L."); 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 expected = new ScientificName(); expected.setFullScientificName("Rhododendron ferrugineum L."); expected.setAuthorshipVerbatim("L."); expected.setGenusOrMonomial("Rhododendron"); expected.setSpecificEpithet("ferrugineum"); expected.setInfraspecificMarker(""); expected.setInfraspecificEpithet(""); ScientificName actual = BrahmsImportUtil.getScientificName(record); assertNotNull("01",actual); assertEquals("02",expected.getFullScientificName(), actual.getFullScientificName()); }
public static ScientificName getScientificName(CSVRecordInfo<BrahmsCsvField> record) { ScientificName sn = new ScientificName(); sn.setFullScientificName(record.get(SPECIES)); sn.setAuthorshipVerbatim(getAuthor(record)); sn.setGenusOrMonomial(record.get(GENUS)); sn.setSpecificEpithet(record.get(SP1)); sn.setInfraspecificMarker(getInfraspecificMarker(record)); sn.setInfraspecificEpithet(getInfraspecificEpithet(record)); if (sn.getFullScientificName() == null) { StringBuilder sb = new StringBuilder(); if (sn.getGenusOrMonomial() != null) { sb.append(sn.getGenusOrMonomial()).append(' '); } if (sn.getSubgenus() != null) { sb.append(sn.getSubgenus()).append(' '); } if (sn.getSpecificEpithet() != null) { sb.append(sn.getSpecificEpithet()).append(' '); } if (sn.getInfraspecificMarker() != null) { sb.append(sn.getInfraspecificMarker()).append(' '); } if (sn.getInfraspecificEpithet() != null) { sb.append(sn.getInfraspecificEpithet()).append(' '); } if (sn.getAuthorshipVerbatim() != null) { if (sn.getAuthorshipVerbatim().charAt(0) != '(') { sb.append('('); } sb.append(sn.getAuthorshipVerbatim()); if (sn.getAuthorshipVerbatim() .charAt(sn.getAuthorshipVerbatim().length() - 1) != ')') { sb.append(')'); } } if (sb.length() != 0) { sn.setFullScientificName(sb.toString().trim()); } } TransformUtil.setScientificNameGroup(sn); return sn; }
BrahmsImportUtil { public static ScientificName getScientificName(CSVRecordInfo<BrahmsCsvField> record) { ScientificName sn = new ScientificName(); sn.setFullScientificName(record.get(SPECIES)); sn.setAuthorshipVerbatim(getAuthor(record)); sn.setGenusOrMonomial(record.get(GENUS)); sn.setSpecificEpithet(record.get(SP1)); sn.setInfraspecificMarker(getInfraspecificMarker(record)); sn.setInfraspecificEpithet(getInfraspecificEpithet(record)); if (sn.getFullScientificName() == null) { StringBuilder sb = new StringBuilder(); if (sn.getGenusOrMonomial() != null) { sb.append(sn.getGenusOrMonomial()).append(' '); } if (sn.getSubgenus() != null) { sb.append(sn.getSubgenus()).append(' '); } if (sn.getSpecificEpithet() != null) { sb.append(sn.getSpecificEpithet()).append(' '); } if (sn.getInfraspecificMarker() != null) { sb.append(sn.getInfraspecificMarker()).append(' '); } if (sn.getInfraspecificEpithet() != null) { sb.append(sn.getInfraspecificEpithet()).append(' '); } if (sn.getAuthorshipVerbatim() != null) { if (sn.getAuthorshipVerbatim().charAt(0) != '(') { sb.append('('); } sb.append(sn.getAuthorshipVerbatim()); if (sn.getAuthorshipVerbatim() .charAt(sn.getAuthorshipVerbatim().length() - 1) != ')') { sb.append(')'); } } if (sb.length() != 0) { sn.setFullScientificName(sb.toString().trim()); } } TransformUtil.setScientificNameGroup(sn); return sn; } }
BrahmsImportUtil { public static ScientificName getScientificName(CSVRecordInfo<BrahmsCsvField> record) { ScientificName sn = new ScientificName(); sn.setFullScientificName(record.get(SPECIES)); sn.setAuthorshipVerbatim(getAuthor(record)); sn.setGenusOrMonomial(record.get(GENUS)); sn.setSpecificEpithet(record.get(SP1)); sn.setInfraspecificMarker(getInfraspecificMarker(record)); sn.setInfraspecificEpithet(getInfraspecificEpithet(record)); if (sn.getFullScientificName() == null) { StringBuilder sb = new StringBuilder(); if (sn.getGenusOrMonomial() != null) { sb.append(sn.getGenusOrMonomial()).append(' '); } if (sn.getSubgenus() != null) { sb.append(sn.getSubgenus()).append(' '); } if (sn.getSpecificEpithet() != null) { sb.append(sn.getSpecificEpithet()).append(' '); } if (sn.getInfraspecificMarker() != null) { sb.append(sn.getInfraspecificMarker()).append(' '); } if (sn.getInfraspecificEpithet() != null) { sb.append(sn.getInfraspecificEpithet()).append(' '); } if (sn.getAuthorshipVerbatim() != null) { if (sn.getAuthorshipVerbatim().charAt(0) != '(') { sb.append('('); } sb.append(sn.getAuthorshipVerbatim()); if (sn.getAuthorshipVerbatim() .charAt(sn.getAuthorshipVerbatim().length() - 1) != ')') { sb.append(')'); } } if (sb.length() != 0) { sn.setFullScientificName(sb.toString().trim()); } } TransformUtil.setScientificNameGroup(sn); return sn; } BrahmsImportUtil(); }
BrahmsImportUtil { public static ScientificName getScientificName(CSVRecordInfo<BrahmsCsvField> record) { ScientificName sn = new ScientificName(); sn.setFullScientificName(record.get(SPECIES)); sn.setAuthorshipVerbatim(getAuthor(record)); sn.setGenusOrMonomial(record.get(GENUS)); sn.setSpecificEpithet(record.get(SP1)); sn.setInfraspecificMarker(getInfraspecificMarker(record)); sn.setInfraspecificEpithet(getInfraspecificEpithet(record)); if (sn.getFullScientificName() == null) { StringBuilder sb = new StringBuilder(); if (sn.getGenusOrMonomial() != null) { sb.append(sn.getGenusOrMonomial()).append(' '); } if (sn.getSubgenus() != null) { sb.append(sn.getSubgenus()).append(' '); } if (sn.getSpecificEpithet() != null) { sb.append(sn.getSpecificEpithet()).append(' '); } if (sn.getInfraspecificMarker() != null) { sb.append(sn.getInfraspecificMarker()).append(' '); } if (sn.getInfraspecificEpithet() != null) { sb.append(sn.getInfraspecificEpithet()).append(' '); } if (sn.getAuthorshipVerbatim() != null) { if (sn.getAuthorshipVerbatim().charAt(0) != '(') { sb.append('('); } sb.append(sn.getAuthorshipVerbatim()); if (sn.getAuthorshipVerbatim() .charAt(sn.getAuthorshipVerbatim().length() - 1) != ')') { sb.append(')'); } } if (sb.length() != 0) { sn.setFullScientificName(sb.toString().trim()); } } TransformUtil.setScientificNameGroup(sn); return sn; } 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 ScientificName getScientificName(CSVRecordInfo<BrahmsCsvField> record) { ScientificName sn = new ScientificName(); sn.setFullScientificName(record.get(SPECIES)); sn.setAuthorshipVerbatim(getAuthor(record)); sn.setGenusOrMonomial(record.get(GENUS)); sn.setSpecificEpithet(record.get(SP1)); sn.setInfraspecificMarker(getInfraspecificMarker(record)); sn.setInfraspecificEpithet(getInfraspecificEpithet(record)); if (sn.getFullScientificName() == null) { StringBuilder sb = new StringBuilder(); if (sn.getGenusOrMonomial() != null) { sb.append(sn.getGenusOrMonomial()).append(' '); } if (sn.getSubgenus() != null) { sb.append(sn.getSubgenus()).append(' '); } if (sn.getSpecificEpithet() != null) { sb.append(sn.getSpecificEpithet()).append(' '); } if (sn.getInfraspecificMarker() != null) { sb.append(sn.getInfraspecificMarker()).append(' '); } if (sn.getInfraspecificEpithet() != null) { sb.append(sn.getInfraspecificEpithet()).append(' '); } if (sn.getAuthorshipVerbatim() != null) { if (sn.getAuthorshipVerbatim().charAt(0) != '(') { sb.append('('); } sb.append(sn.getAuthorshipVerbatim()); if (sn.getAuthorshipVerbatim() .charAt(sn.getAuthorshipVerbatim().length() - 1) != ')') { sb.append(')'); } } if (sb.length() != 0) { sn.setFullScientificName(sb.toString().trim()); } } TransformUtil.setScientificNameGroup(sn); return sn; } 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();  }