test(annotations): add Testcontainers integration tests for V33 chk_annotation_bounds [B1]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-14 14:36:37 +02:00
parent 40c8f548db
commit 72700bd28f

View File

@@ -121,6 +121,53 @@ class MigrationIntegrationTest {
assertThat(rows2).isEqualTo(1);
}
// ─── V33: chk_annotation_bounds CHECK constraint ─────────────────────────
@Test
void v33_boundsCheckConstraint_rejectsXAboveOne() {
UUID docId = createDocument();
assertThatThrownBy(() ->
jdbc.update(
"""
INSERT INTO document_annotations
(id, document_id, page_number, x, y, width, height, color)
VALUES (gen_random_uuid(), ?, 1, 1.5, 0.1, 0.3, 0.1, '#ff0000')
""",
docId)
).isInstanceOf(DataIntegrityViolationException.class);
}
@Test
void v33_boundsCheckConstraint_rejectsHeightBelowMinimum() {
UUID docId = createDocument();
assertThatThrownBy(() ->
jdbc.update(
"""
INSERT INTO document_annotations
(id, document_id, page_number, x, y, width, height, color)
VALUES (gen_random_uuid(), ?, 1, 0.1, 0.1, 0.3, 0.005, '#ff0000')
""",
docId)
).isInstanceOf(DataIntegrityViolationException.class);
}
@Test
void v33_boundsCheckConstraint_acceptsValidAnnotation() {
UUID docId = createDocument();
int rows = jdbc.update(
"""
INSERT INTO document_annotations
(id, document_id, page_number, x, y, width, height, color)
VALUES (gen_random_uuid(), ?, 1, 0.1, 0.1, 0.3, 0.1, '#ff0000')
""",
docId);
assertThat(rows).isEqualTo(1);
}
// ─── helpers ─────────────────────────────────────────────────────────────
private UUID createDocument() {