test(person): pin fetchPool dedup when one person matches two tokens (#763 review)
All checks were successful
CI / Unit & Component Tests (push) Successful in 3m20s
CI / OCR Service Tests (push) Successful in 24s
CI / Backend Unit Tests (push) Successful in 3m53s
CI / fail2ban Regex (push) Successful in 44s
CI / Semgrep Security Scan (push) Successful in 21s
CI / Compose Bucket Idempotency (push) Successful in 1m5s
All checks were successful
CI / Unit & Component Tests (push) Successful in 3m20s
CI / OCR Service Tests (push) Successful in 24s
CI / Backend Unit Tests (push) Successful in 3m53s
CI / fail2ban Regex (push) Successful in 44s
CI / Semgrep Security Scan (push) Successful in 21s
CI / Compose Bucket Idempotency (push) Successful in 1m5s
Assert that when the same person id is returned by two different token fetches, the person appears exactly once in the result -- pinning fetchPool's putIfAbsent dedup so a future refactor can't silently double-classify a candidate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit was merged in pull request #769.
This commit is contained in:
@@ -1045,4 +1045,18 @@ class PersonServiceTest {
|
|||||||
|
|
||||||
verify(personRepository, org.mockito.Mockito.atMost(8)).searchByName(any());
|
verify(personRepository, org.mockito.Mockito.atMost(8)).searchByName(any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void resolveByName_samePersonFromTwoTokens_appearsOnce() {
|
||||||
|
// Both token fetches return the same person id — fetchPool's putIfAbsent must dedup so the
|
||||||
|
// candidate is classified once, not twice.
|
||||||
|
Person clara = Person.builder().id(UUID.randomUUID()).firstName("Clara").lastName("Cram").build();
|
||||||
|
when(personRepository.searchByName("clara")).thenReturn(List.of(clara));
|
||||||
|
when(personRepository.searchByName("cram")).thenReturn(List.of(clara));
|
||||||
|
|
||||||
|
NameMatches result = personService.resolveByName("Clara Cram");
|
||||||
|
|
||||||
|
assertThat(result.direct()).hasSize(1);
|
||||||
|
assertThat(result.partial()).isEmpty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user