Skip to content

Commit

Permalink
#392 fix wrong enum issue
Browse files Browse the repository at this point in the history
  • Loading branch information
muttcg committed Oct 6, 2020
1 parent 60385fc commit 3325565
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import static org.gbif.api.vocabulary.OccurrenceIssue.OCCURRENCE_STATUS_UNPARSABLE;
import static org.gbif.api.vocabulary.OccurrenceIssue.REFERENCES_URI_INVALID;
import static org.gbif.api.vocabulary.OccurrenceIssue.TYPE_STATUS_INVALID;
import static org.gbif.dwc.terms.DwcTerm.basisOfRecord;
import static org.gbif.pipelines.core.utils.ModelUtils.addIssue;
import static org.gbif.pipelines.core.utils.ModelUtils.extractOptValue;
import static org.gbif.pipelines.core.utils.ModelUtils.extractValue;
Expand Down Expand Up @@ -362,7 +361,7 @@ public static BiConsumer<ExtendedRecord, BasicRecord> interpretOccurrenceStatus(

// https://github.com/gbif/pipelines/issues/392
boolean isSpecimen =
extractOptValue(er, basisOfRecord)
Optional.ofNullable(br.getBasisOfRecord())
.map(BasisOfRecord::valueOf)
.map(
x ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ public void When_CountIsZeroAndStatusIsNullAndPreservedSpecimen_Expect_Present()
Map<String, String> coreTerms = new HashMap<>(3);
coreTerms.put(DwcTerm.individualCount.qualifiedName(), "0");
coreTerms.put(DwcTerm.occurrenceStatus.qualifiedName(), null);
coreTerms.put(DwcTerm.basisOfRecord.qualifiedName(), "PRESERVED_SPECIMEN");

ExtendedRecord er = ExtendedRecord.newBuilder().setId(ID).setCoreTerms(coreTerms).build();
BasicRecord br = BasicRecord.newBuilder().setId(ID).build();
BasicRecord br =
BasicRecord.newBuilder().setId(ID).setBasisOfRecord("PRESERVED_SPECIMEN").build();

BasicInterpreter.interpretIndividualCount(er, br);

Expand All @@ -235,10 +235,9 @@ public void When_CountIsZeroAndStatusIsNullAndFossilSpecimen_Expect_Present() {
Map<String, String> coreTerms = new HashMap<>(3);
coreTerms.put(DwcTerm.individualCount.qualifiedName(), "0");
coreTerms.put(DwcTerm.occurrenceStatus.qualifiedName(), null);
coreTerms.put(DwcTerm.basisOfRecord.qualifiedName(), "FOSSIL_SPECIMEN");

ExtendedRecord er = ExtendedRecord.newBuilder().setId(ID).setCoreTerms(coreTerms).build();
BasicRecord br = BasicRecord.newBuilder().setId(ID).build();
BasicRecord br = BasicRecord.newBuilder().setId(ID).setBasisOfRecord("FOSSIL_SPECIMEN").build();

BasicInterpreter.interpretIndividualCount(er, br);

Expand All @@ -257,10 +256,9 @@ public void When_CountIsZeroAndStatusIsNullAndLivingSpecimen_Expect_Present() {
Map<String, String> coreTerms = new HashMap<>(3);
coreTerms.put(DwcTerm.individualCount.qualifiedName(), "0");
coreTerms.put(DwcTerm.occurrenceStatus.qualifiedName(), null);
coreTerms.put(DwcTerm.basisOfRecord.qualifiedName(), "LIVING_SPECIMEN");

ExtendedRecord er = ExtendedRecord.newBuilder().setId(ID).setCoreTerms(coreTerms).build();
BasicRecord br = BasicRecord.newBuilder().setId(ID).build();
BasicRecord br = BasicRecord.newBuilder().setId(ID).setBasisOfRecord("LIVING_SPECIMEN").build();

BasicInterpreter.interpretIndividualCount(er, br);

Expand Down

0 comments on commit 3325565

Please sign in to comment.