Skip to content

Commit 03e4dab

Browse files
fixed all e2e tests
1 parent 74585a6 commit 03e4dab

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.sap.ai.sdk.app.controllers;
22

3+
import static com.sap.ai.sdk.orchestration.model.ResponseChatMessage.RoleEnum.ASSISTANT;
34
import static org.assertj.core.api.Assertions.assertThat;
45
import static org.assertj.core.api.Assertions.assertThatThrownBy;
56

@@ -86,7 +87,7 @@ void testTemplate() {
8687
var choices = llm.getChoices();
8788
assertThat(choices.get(0).getIndex()).isZero();
8889
assertThat(choices.get(0).getMessage().getContent()).isNotEmpty();
89-
assertThat(choices.get(0).getMessage().getRole()).isEqualTo("assistant");
90+
assertThat(choices.get(0).getMessage().getRole()).isEqualTo(ASSISTANT);
9091
assertThat(choices.get(0).getFinishReason()).isEqualTo("stop");
9192
var usage = result.getTokenUsage();
9293
assertThat(usage.getCompletionTokens()).isGreaterThan(1);
@@ -100,7 +101,7 @@ void testTemplate() {
100101
choices = orchestrationResult.getChoices();
101102
assertThat(choices.get(0).getIndex()).isZero();
102103
assertThat(choices.get(0).getMessage().getContent()).isNotEmpty();
103-
assertThat(choices.get(0).getMessage().getRole()).isEqualTo("assistant");
104+
assertThat(choices.get(0).getMessage().getRole()).isEqualTo(ASSISTANT);
104105
assertThat(choices.get(0).getFinishReason()).isEqualTo("stop");
105106
assertThat(result.getChoice()).isSameAs(choices.get(0));
106107
usage = result.getTokenUsage();
@@ -201,7 +202,7 @@ void testInputFilteringStrict() {
201202
assertThatThrownBy(() -> service.inputFiltering(policy))
202203
.isInstanceOf(OrchestrationClientException.class)
203204
.hasMessageContaining(
204-
"Content filtered due to safety violations. Please modify the prompt and try again.")
205+
"Prompt filtered due to safety violations. Please modify the prompt and try again.")
205206
.hasMessageContaining("400 Bad Request");
206207
}
207208

@@ -246,7 +247,7 @@ void testLlamaGuardEnabled() {
246247
assertThatThrownBy(() -> service.llamaGuardInputFilter(true))
247248
.isInstanceOf(OrchestrationClientException.class)
248249
.hasMessageContaining(
249-
"Content filtered due to safety violations. Please modify the prompt and try again.")
250+
"Prompt filtered due to safety violations. Please modify the prompt and try again.")
250251
.hasMessageContaining("400 Bad Request");
251252
}
252253

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void testInputFilteringStrict() {
6767
assertThatThrownBy(() -> service.inputFiltering(policy))
6868
.isInstanceOf(OrchestrationClientException.class)
6969
.hasMessageContaining(
70-
"Content filtered due to safety violations. Please modify the prompt and try again.")
70+
"Prompt filtered due to safety violations. Please modify the prompt and try again.")
7171
.hasMessageContaining("400 Bad Request");
7272
}
7373

0 commit comments

Comments
 (0)