feat(document): remove conversation service methods
Delete getConversationFiltered (the endpoint's only caller is gone) and the dead 2-arg getConversation(personA, personB) which had zero callers, along with both getConversationFiltered test blocks. The hasSender/ hasReceiver specifications stay — document search still uses them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1128,53 +1128,6 @@ class DocumentServiceTest {
|
||||
.isEqualTo("19650332_Mueller_Hans");
|
||||
}
|
||||
|
||||
// ─── getConversationFiltered ───────────────────────────────────────────────
|
||||
|
||||
@Test
|
||||
void getConversationFiltered_passesGivenDates_whenFromAndToAreProvided() {
|
||||
UUID senderId = UUID.randomUUID();
|
||||
UUID receiverId = UUID.randomUUID();
|
||||
LocalDate from = LocalDate.of(1940, 1, 1);
|
||||
LocalDate to = LocalDate.of(1960, 12, 31);
|
||||
Sort sort = Sort.by(Sort.Direction.ASC, "documentDate");
|
||||
when(documentRepository.findConversation(senderId, receiverId, from, to, sort))
|
||||
.thenReturn(List.of());
|
||||
|
||||
documentService.getConversationFiltered(senderId, receiverId, from, to, sort);
|
||||
|
||||
verify(documentRepository).findConversation(senderId, receiverId, from, to, sort);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getConversationFiltered_usesMinDateForFrom_whenFromIsNull() {
|
||||
UUID senderId = UUID.randomUUID();
|
||||
UUID receiverId = UUID.randomUUID();
|
||||
Sort sort = Sort.by(Sort.Direction.ASC, "documentDate");
|
||||
when(documentRepository.findConversation(eq(senderId), eq(receiverId), any(LocalDate.class), any(LocalDate.class), eq(sort)))
|
||||
.thenReturn(List.of());
|
||||
|
||||
documentService.getConversationFiltered(senderId, receiverId, null, null, sort);
|
||||
|
||||
ArgumentCaptor<LocalDate> fromCaptor = ArgumentCaptor.forClass(LocalDate.class);
|
||||
verify(documentRepository).findConversation(eq(senderId), eq(receiverId), fromCaptor.capture(), any(LocalDate.class), eq(sort));
|
||||
assertThat(fromCaptor.getValue()).isEqualTo(LocalDate.parse("0000-01-01"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getConversationFiltered_usesTodayForTo_whenToIsNull() {
|
||||
UUID senderId = UUID.randomUUID();
|
||||
UUID receiverId = UUID.randomUUID();
|
||||
Sort sort = Sort.by(Sort.Direction.ASC, "documentDate");
|
||||
when(documentRepository.findConversation(eq(senderId), eq(receiverId), any(LocalDate.class), any(LocalDate.class), eq(sort)))
|
||||
.thenReturn(List.of());
|
||||
|
||||
documentService.getConversationFiltered(senderId, receiverId, null, null, sort);
|
||||
|
||||
ArgumentCaptor<LocalDate> toCaptor = ArgumentCaptor.forClass(LocalDate.class);
|
||||
verify(documentRepository).findConversation(eq(senderId), eq(receiverId), any(LocalDate.class), toCaptor.capture(), eq(sort));
|
||||
assertThat(toCaptor.getValue()).isEqualTo(LocalDate.now());
|
||||
}
|
||||
|
||||
// ─── updateDocumentTags — empty tag in list ───────────────────────────────
|
||||
|
||||
@Test
|
||||
@@ -1760,35 +1713,6 @@ class DocumentServiceTest {
|
||||
.isEqualTo(Sort.by(Sort.Direction.DESC, "updatedAt"));
|
||||
}
|
||||
|
||||
// ─── getConversationFiltered (single-person mode) ─────────────────────────
|
||||
|
||||
@Test
|
||||
void getConversationFiltered_callsSinglePersonQuery_whenReceiverIdIsNull() {
|
||||
UUID personId = UUID.randomUUID();
|
||||
Sort sort = Sort.by(Sort.Direction.DESC, "documentDate");
|
||||
when(documentRepository.findSinglePersonCorrespondence(eq(personId), any(), any(), eq(sort)))
|
||||
.thenReturn(List.of());
|
||||
|
||||
documentService.getConversationFiltered(personId, null, null, null, sort);
|
||||
|
||||
verify(documentRepository).findSinglePersonCorrespondence(eq(personId), any(), any(), eq(sort));
|
||||
verify(documentRepository, never()).findConversation(any(), any(), any(), any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getConversationFiltered_callsBilateralQuery_whenReceiverIdIsSet() {
|
||||
UUID senderId = UUID.randomUUID();
|
||||
UUID receiverId = UUID.randomUUID();
|
||||
Sort sort = Sort.by(Sort.Direction.DESC, "documentDate");
|
||||
when(documentRepository.findConversation(eq(senderId), eq(receiverId), any(), any(), eq(sort)))
|
||||
.thenReturn(List.of());
|
||||
|
||||
documentService.getConversationFiltered(senderId, receiverId, null, null, sort);
|
||||
|
||||
verify(documentRepository).findConversation(eq(senderId), eq(receiverId), any(), any(), eq(sort));
|
||||
verify(documentRepository, never()).findSinglePersonCorrespondence(any(), any(), any(), any());
|
||||
}
|
||||
|
||||
// ─── searchDocuments — SENDER sort includes documents with null sender ─────
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user