test(training): strengthen TrainingBlockQueryTest assertions
Some checks failed
CI / Backend Unit Tests (push) Failing after 3m5s
CI / Unit & Component Tests (pull_request) Failing after 3m22s
CI / OCR Service Tests (pull_request) Successful in 40s
CI / Backend Unit Tests (pull_request) Failing after 3m16s
CI / Unit & Component Tests (push) Failing after 4m2s
CI / OCR Service Tests (push) Successful in 37s
Some checks failed
CI / Backend Unit Tests (push) Failing after 3m5s
CI / Unit & Component Tests (pull_request) Failing after 3m22s
CI / OCR Service Tests (pull_request) Successful in 40s
CI / Backend Unit Tests (pull_request) Failing after 3m16s
CI / Unit & Component Tests (push) Failing after 4m2s
CI / OCR Service Tests (push) Successful in 37s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import org.springframework.boot.jdbc.test.autoconfigure.AutoConfigureTestDatabas
|
||||
import org.springframework.boot.data.jpa.test.autoconfigure.DataJpaTest;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -37,7 +38,7 @@ class TrainingBlockQueryTest {
|
||||
.title("Kurrent Brief")
|
||||
.originalFilename("kurrent.pdf")
|
||||
.status(DocumentStatus.UPLOADED)
|
||||
.trainingLabels(new java.util.HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION)))
|
||||
.trainingLabels(new HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION)))
|
||||
.build());
|
||||
kurrentDocId = kurrentDoc.getId();
|
||||
|
||||
@@ -122,7 +123,7 @@ class TrainingBlockQueryTest {
|
||||
.originalFilename("karl.pdf")
|
||||
.status(DocumentStatus.UPLOADED)
|
||||
.sender(sender)
|
||||
.trainingLabels(new java.util.HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION)))
|
||||
.trainingLabels(new HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION)))
|
||||
.build());
|
||||
UUID annId = annotationRepository.save(annotation(doc.getId())).getId();
|
||||
blockRepository.save(block(doc.getId(), annId, BlockSource.MANUAL, false));
|
||||
@@ -157,7 +158,7 @@ class TrainingBlockQueryTest {
|
||||
.originalFilename("karl.pdf")
|
||||
.status(DocumentStatus.UPLOADED)
|
||||
.sender(sender)
|
||||
.trainingLabels(new java.util.HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION)))
|
||||
.trainingLabels(new HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION)))
|
||||
.build());
|
||||
UUID annId = annotationRepository.save(annotation(doc.getId())).getId();
|
||||
blockRepository.save(block(doc.getId(), annId, BlockSource.OCR, false));
|
||||
@@ -176,7 +177,7 @@ class TrainingBlockQueryTest {
|
||||
.originalFilename("karl.pdf")
|
||||
.status(DocumentStatus.UPLOADED)
|
||||
.sender(karl)
|
||||
.trainingLabels(new java.util.HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION)))
|
||||
.trainingLabels(new HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION)))
|
||||
.build());
|
||||
UUID annId = annotationRepository.save(annotation(doc.getId())).getId();
|
||||
blockRepository.save(block(doc.getId(), annId, BlockSource.MANUAL, false));
|
||||
@@ -194,15 +195,25 @@ class TrainingBlockQueryTest {
|
||||
.originalFilename("karl.pdf")
|
||||
.status(DocumentStatus.UPLOADED)
|
||||
.sender(sender)
|
||||
.trainingLabels(new java.util.HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION)))
|
||||
.trainingLabels(new HashSet<>(Set.of(TrainingLabel.KURRENT_RECOGNITION)))
|
||||
.build());
|
||||
UUID annId = annotationRepository.save(annotation(doc.getId())).getId();
|
||||
blockRepository.save(block(doc.getId(), annId, BlockSource.MANUAL, false));
|
||||
blockRepository.save(block(doc.getId(), annId, BlockSource.MANUAL, true));
|
||||
|
||||
long count = blockRepository.countManualKurrentBlocksByPerson(sender.getId());
|
||||
List<TranscriptionBlock> found = blockRepository.findManualKurrentBlocksByPerson(sender.getId());
|
||||
|
||||
assertThat(count).isEqualTo(2);
|
||||
assertThat(count).isEqualTo(found.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void countManualKurrentBlocksByPerson_returnsZeroWhenNoBlocksMatch() {
|
||||
Person sender = personRepository.save(Person.builder().firstName("Karl").lastName("Test").build());
|
||||
|
||||
long count = blockRepository.countManualKurrentBlocksByPerson(sender.getId());
|
||||
|
||||
assertThat(count).isZero();
|
||||
}
|
||||
|
||||
// ─── helpers ─────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user