feat(themen): count documents across the whole sub-topic tree (#698) #701

Merged
marcel merged 8 commits from worktree-feat+issue-698-themen-subtree-count into main 2026-05-31 12:58:10 +02:00
Showing only changes of commit a76999c3d4 - Show all commits

View File

@@ -199,6 +199,7 @@ class TagServiceTest {
void getTagTree_returnsEmptyList_whenNoTags() {
when(tagRepository.findAll()).thenReturn(List.of());
when(tagRepository.findDocumentCountsPerTag()).thenReturn(List.of());
when(tagRepository.findSubtreeDocumentCountsPerTag()).thenReturn(List.of());
assertThat(tagService.getTagTree()).isEmpty();
}
@@ -213,6 +214,7 @@ class TagServiceTest {
);
when(tagRepository.findAll()).thenReturn(tags);
when(tagRepository.findDocumentCountsPerTag()).thenReturn(List.of());
when(tagRepository.findSubtreeDocumentCountsPerTag()).thenReturn(List.of());
var tree = tagService.getTagTree();
@@ -228,6 +230,7 @@ class TagServiceTest {
Tag child = Tag.builder().id(childId).name("Child").parentId(parentId).build();
when(tagRepository.findAll()).thenReturn(List.of(parent, child));
when(tagRepository.findDocumentCountsPerTag()).thenReturn(List.of());
when(tagRepository.findSubtreeDocumentCountsPerTag()).thenReturn(List.of());
var tree = tagService.getTagTree();
@@ -247,6 +250,7 @@ class TagServiceTest {
Tag child = Tag.builder().id(childId).name("Child").parentId(parentId).build();
when(tagRepository.findAll()).thenReturn(List.of(parent, child));
when(tagRepository.findDocumentCountsPerTag()).thenReturn(List.of());
when(tagRepository.findSubtreeDocumentCountsPerTag()).thenReturn(List.of());
var tree = tagService.getTagTree();
@@ -262,6 +266,7 @@ class TagServiceTest {
when(countEntry.getCount()).thenReturn(5L);
when(tagRepository.findAll()).thenReturn(List.of(tag));
when(tagRepository.findDocumentCountsPerTag()).thenReturn(List.of(countEntry));
when(tagRepository.findSubtreeDocumentCountsPerTag()).thenReturn(List.of());
var tree = tagService.getTagTree();
@@ -272,6 +277,7 @@ class TagServiceTest {
void getTagTree_callsFindDocumentCountsPerTag_exactlyOnce() {
when(tagRepository.findAll()).thenReturn(List.of());
when(tagRepository.findDocumentCountsPerTag()).thenReturn(List.of());
when(tagRepository.findSubtreeDocumentCountsPerTag()).thenReturn(List.of());
tagService.getTagTree();