Skip to content

Commit 20432d1

Browse files
Revert e2e test fixes
1 parent daf7727 commit 20432d1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.sap.ai.sdk.orchestration.client.model.CompletionPostResponse;
99
import com.sap.ai.sdk.orchestration.client.model.LLMChoice;
1010
import com.sap.ai.sdk.orchestration.client.model.LLMModuleResultSynchronous;
11+
import java.util.List;
1112
import java.util.Map;
1213
import lombok.extern.slf4j.Slf4j;
1314
import org.assertj.core.api.InstanceOfAssertFactories;
@@ -75,7 +76,7 @@ void testTemplate() {
7576

7677
@Test
7778
void testLenientContentFilter() {
78-
var response = controller.filter(AzureFilterThreshold.ALLOW_ALL);
79+
var response = controller.filter(AzureFilterThreshold.ALLOW_SAFE_LOW_MEDIUM);
7980
var result = response.getOriginalResponse();
8081
var llmChoice =
8182
((LLMModuleResultSynchronous) result.getOrchestrationResult()).getChoices().get(0);
@@ -113,8 +114,8 @@ void testMaskingAnonymization() {
113114
var maskingResult = result.getModuleResults().getInputMasking();
114115
assertThat(maskingResult.getMessage()).isNotEmpty();
115116
var data = (Map<String, Object>) maskingResult.getData();
116-
var maskedMessage = (String) data.get("masked_template");
117-
assertThat(maskedMessage)
117+
var maskedMessage = ((List<Map<String, Object>>) data.get("masked_template")).get(0);
118+
assertThat(maskedMessage.get("content"))
118119
.asInstanceOf(InstanceOfAssertFactories.STRING)
119120
.doesNotContain("Alice", "Bob");
120121

@@ -136,8 +137,8 @@ void testMaskingPseudonymization() {
136137
var maskingResult = result.getModuleResults().getInputMasking();
137138
assertThat(maskingResult.getMessage()).isNotEmpty();
138139
var data = (Map<String, Object>) maskingResult.getData();
139-
var maskedMessage = (String) data.get("masked_template");
140-
assertThat(maskedMessage)
140+
var maskedMessage = ((List<Map<String, Object>>) data.get("masked_template")).get(1);
141+
assertThat(maskedMessage.get("content"))
141142
.asInstanceOf(InstanceOfAssertFactories.STRING)
142143
.describedAs("The masked input should not contain any user names but only pseudonyms")
143144
.doesNotContain("Mallory", "Alice", "Bob")

0 commit comments

Comments
 (0)