Skip to content

Commit

Permalink
#496 accept different owner matches (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-lg authored Sep 5, 2023
1 parent f7d531e commit 20c3487
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,20 +389,14 @@ public void ownerInstitutionCodeTest() {
LookupResult result = lookupService.lookup(params);

// Should
assertEquals(Match.MatchType.NONE, result.getInstitutionMatch().getMatchType());
assertEquals(Match.Status.AMBIGUOUS_OWNER, result.getInstitutionMatch().getStatus());
// https://github.com/gbif/registry/issues/496 we accept matches with different owner but we
// flag them
assertEquals(Match.MatchType.EXACT, result.getInstitutionMatch().getMatchType());
assertEquals(Match.Status.ACCEPTED, result.getInstitutionMatch().getStatus());
assertTrue(result.getInstitutionMatch().getReasons().contains(Match.Reason.DIFFERENT_OWNER));
assertEquals(Match.MatchType.NONE, result.getCollectionMatch().getMatchType());
assertNull(result.getCollectionMatch().getStatus());
assertEquals(1, result.getAlternativeMatches().getInstitutionMatches().size());

Match<InstitutionMatched> alternative =
result.getAlternativeMatches().getInstitutionMatches().get(0);
assertEquals(Match.MatchType.EXACT, alternative.getMatchType());
assertEquals(i2.getKey(), alternative.getEntityMatched().getKey());
assertEquals(3, alternative.getReasons().size());
assertTrue(alternative.getReasons().contains(Match.Reason.CODE_MATCH));
assertTrue(alternative.getReasons().contains(Match.Reason.IDENTIFIER_MATCH));
assertTrue(alternative.getReasons().contains(Match.Reason.DIFFERENT_OWNER));
assertEquals(0, result.getAlternativeMatches().getInstitutionMatches().size());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ private Matches<InstitutionMatched> setAccepted(Matches<InstitutionMatched> matc
matches.getExplicitMatches(),
matches.getExactMatches(),
matches.getFuzzyMatches(),
m -> !m.getReasons().contains(DIFFERENT_OWNER),
m -> !m.getReasons().contains(DIFFERENT_OWNER),
null,
null,
Match.Status.AMBIGUOUS_OWNER));

return matches;
Expand Down

0 comments on commit 20c3487

Please sign in to comment.