Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
samleeflang committed Oct 23, 2023
1 parent c2f5b86 commit ea0c09e
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.ScientificName;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.ScientificNameAuthorship;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.SpecificEpithet;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.SubTribe;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Subtribe;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Subfamily;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Subgenus;
import eu.dissco.core.translator.terms.specimen.identification.taxonomy.Superfamily;
Expand Down Expand Up @@ -337,7 +337,7 @@ protected Identifications createIdentification(JsonNode data, boolean dwc) {
.withDwcInfraspecificEpithet(termMapper.retrieveTerm(new InfraspecificEpithet(), data, dwc))
.withDwcNomenclaturalStatus(termMapper.retrieveTerm(new NomenclaturalStatus(), data, dwc))
.withDwcOriginalNameUsage(termMapper.retrieveTerm(new OriginalNameUsage(), data, dwc))
.withDwcSubtribe(termMapper.retrieveTerm(new SubTribe(), data, dwc))
.withDwcSubtribe(termMapper.retrieveTerm(new Subtribe(), data, dwc))
.withDwcSuperfamily(termMapper.retrieveTerm(new Superfamily(), data, dwc))
.withDwcTribe(termMapper.retrieveTerm(new Tribe(), data, dwc));
return new Identifications()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class InfraGenericEpithet extends Term {
private final List<String> dwcaTerms = List.of(TERM);
private final List<String> abcdTerms = List.of(
"result/taxonIdentified/scientificName/nameAtomised/botanical/firstEpithet",
"result/taxonIdentified/scientificName/nameAtomised/zoological/subspeciesEpithet",
"result/taxonIdentified/scientificName/nameAtomised/zoological/subgenus",
"result/taxonIdentified/scientificName/nameAtomised/bacterial/subgenus");

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class InfraspecificEpithet extends AbstractTaxonomy {
private final List<String> dwcaTerms = List.of(TERM);
private final List<String> abcdTerms = List.of(
"result/taxonIdentified/scientificName/nameAtomised/botanical/infraspecificEpithet",
"result/taxonIdentified/scientificName/nameAtomised/botanical/secondEpithet",
"result/taxonIdentified/scientificName/nameAtomised/zoological/subspeciesEpithet",
"result/taxonIdentified/scientificName/nameAtomised/bacterial/subspeciesEpithet");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public class SpecificEpithet extends AbstractTaxonomy {
public static final String TERM = DWC_PREFIX + "specificEpithet";
private final List<String> abcdTerms = List.of(
"result/taxonIdentified/scientificName/nameAtomised/botanical/firstEpithet",
"result/taxonIdentified/scientificName/nameAtomised/zoological/subgenus",
"result/taxonIdentified/scientificName/nameAtomised/bacterial/subgenus");
"result/taxonIdentified/scientificName/nameAtomised/zoological/speciesEpithet",
"result/taxonIdentified/scientificName/nameAtomised/bacterial/speciesEpithet");
private final List<String> dwcaTerms = List.of(TERM);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import java.util.List;

public class SubTribe extends AbstractTaxonomy {
public class Subtribe extends AbstractTaxonomy {

public static final String TERM = DWC_PREFIX + "subtribe";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ class CultivarEpithetTest {

private final CultivarEpithet cultivarEpithet = new CultivarEpithet();

private final String cultivaEpithetString = "King Edward";
private final String cultivarEpithetString = "King Edward";

@Test
void testRetrieveFromDWCA() {
// Given
var unit = MAPPER.createObjectNode();
unit.put("dwc:cultivarEpithet", cultivaEpithetString);
unit.put("dwc:cultivarEpithet", cultivarEpithetString);

// When
var result = cultivarEpithet.retrieveFromDWCA(unit);

// Then
assertThat(result).isEqualTo(cultivaEpithetString);
assertThat(result).isEqualTo(cultivarEpithetString);
}

@Test
Expand All @@ -33,13 +33,13 @@ void testRetrieveFromABCD() {
var unit = MAPPER.createObjectNode();
unit.put(
"result/taxonIdentified/scientificName/nameAtomised/botanical/cultivarName",
cultivaEpithetString);
cultivarEpithetString);

// When
var result = cultivarEpithet.retrieveFromABCD(unit);

// Then
assertThat(result).isEqualTo(cultivaEpithetString);
assertThat(result).isEqualTo(cultivarEpithetString);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
import org.mockito.junit.jupiter.MockitoExtension;

@ExtendWith(MockitoExtension.class)
class SubTribeTest {
class SubtribeTest {

private final SubTribe subTribe = new SubTribe();
private final String subTribeString = "Plotinini";
private final Subtribe subtribe = new Subtribe();
private final String subtribeString = "Plotinini";

@Test
void testRetrieveFromDWCA() {
// Given
var unit = MAPPER.createObjectNode();
unit.put("dwc:subtribe", subTribeString);
unit.put("dwc:subtribe", subtribeString);

// When
var result = subTribe.retrieveFromDWCA(unit);
var result = subtribe.retrieveFromDWCA(unit);

// Then
assertThat(result).isEqualTo(subTribeString);
assertThat(result).isEqualTo(subtribeString);
}

@Test
Expand All @@ -35,21 +35,21 @@ void testRetrieveFromABCD() {
"subtribus");
unit.put(
"result/taxonIdentified/higherTaxa/higherTaxon/0/higherTaxonName",
subTribeString);
subtribeString);

// When
var result = subTribe.retrieveFromABCD(unit);
var result = subtribe.retrieveFromABCD(unit);

// Then
assertThat(result).isEqualTo(subTribeString);
assertThat(result).isEqualTo(subtribeString);
}

@Test
void testGetTerm() {
// When
var result = subTribe.getTerm();
var result = subtribe.getTerm();

// Then
assertThat(result).isEqualTo(SubTribe.TERM);
assertThat(result).isEqualTo(Subtribe.TERM);
}
}

0 comments on commit ea0c09e

Please sign in to comment.