Skip to content

Commit 8e241e5

Browse files
author
I750911
committed
adapted e2e tests to comply with no exception throwing
1 parent 95a61f3 commit 8e241e5

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/SpringAiOrchestrationTest.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,18 @@ void testInputFilteringLenient() {
9393
void testOutputFilteringStrict() {
9494
var policy = AzureFilterThreshold.ALLOW_SAFE;
9595

96-
assertThatThrownBy(() -> service.outputFiltering(policy))
97-
.isInstanceOf(OrchestrationClientException.class)
98-
.hasMessageContaining("Content filter filtered the output.");
96+
var response = service.outputFiltering(policy);
97+
98+
assertThat(response.getResult().getMetadata().getFinishReason()).isEqualTo("content_filter");
99+
assertThat(response.getResult().getOutput().getText()).isEmpty();
100+
101+
var filterResult =
102+
((OrchestrationSpringChatResponse) response)
103+
.getOrchestrationResponse()
104+
.getOriginalResponse()
105+
.getModuleResults()
106+
.getOutputFiltering();
107+
assertThat(filterResult.getMessage()).containsPattern("1 of 1 choices failed");
99108
}
100109

101110
@Test

0 commit comments

Comments
 (0)