M7 N2 Logging-Sensitivität produktiv verdrahtet und verifiziert

This commit is contained in:
2026-04-08 06:26:54 +02:00
parent 788f6110d4
commit ac3662e758
7 changed files with 175 additions and 4 deletions
@@ -1,5 +1,6 @@
package de.gecheckt.pdf.umbenenner.bootstrap.adapter;
import de.gecheckt.pdf.umbenenner.application.port.out.AiContentSensitivity;
import de.gecheckt.pdf.umbenenner.application.port.out.ProcessingLogger;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
@@ -188,4 +189,54 @@ class Log4jProcessingLoggerTest {
() -> assertDoesNotThrow(() -> logger.error(testMessage, exception))
);
}
@Test
void debugSensitiveAiContent_withDefaultSensitivity_acceptsMessage() {
// Verify debugSensitiveAiContent method exists and executes with default PROTECT sensitivity
Log4jProcessingLogger protectedLogger = new Log4jProcessingLogger(
Log4jProcessingLoggerTest.class,
AiContentSensitivity.PROTECT_SENSITIVE_CONTENT);
assertDoesNotThrow(() -> {
protectedLogger.debugSensitiveAiContent("Sensitive content: {}", "raw AI response");
}, "debugSensitiveAiContent() should execute without throwing with PROTECT_SENSITIVE_CONTENT");
}
@Test
void debugSensitiveAiContent_withLogSensitivity_acceptsMessage() {
// Verify debugSensitiveAiContent method executes with LOG_SENSITIVE_CONTENT setting
Log4jProcessingLogger logSensitiveLogger = new Log4jProcessingLogger(
Log4jProcessingLoggerTest.class,
AiContentSensitivity.LOG_SENSITIVE_CONTENT);
assertDoesNotThrow(() -> {
logSensitiveLogger.debugSensitiveAiContent("AI reasoning: {}", "complete reasoning text");
}, "debugSensitiveAiContent() should execute without throwing with LOG_SENSITIVE_CONTENT");
}
@Test
void constructorWithSensitivity_acceptsProtectSensitiveContent() {
// Verify constructor accepts PROTECT_SENSITIVE_CONTENT
Log4jProcessingLogger logger1 = new Log4jProcessingLogger(
Log4jProcessingLoggerTest.class,
AiContentSensitivity.PROTECT_SENSITIVE_CONTENT);
assertNotNull(logger1, "Logger should be created with PROTECT_SENSITIVE_CONTENT");
}
@Test
void constructorWithSensitivity_acceptsLogSensitiveContent() {
// Verify constructor accepts LOG_SENSITIVE_CONTENT
Log4jProcessingLogger logger2 = new Log4jProcessingLogger(
Log4jProcessingLoggerTest.class,
AiContentSensitivity.LOG_SENSITIVE_CONTENT);
assertNotNull(logger2, "Logger should be created with LOG_SENSITIVE_CONTENT");
}
@Test
void constructorWithSensitivity_rejectNullSensitivity() {
// Verify constructor requires non-null AiContentSensitivity
assertThrows(NullPointerException.class, () -> {
new Log4jProcessingLogger(Log4jProcessingLoggerTest.class, null);
}, "Constructor should reject null AiContentSensitivity");
}
}