Skip to content

Commit e426a2d

Browse files
committed
test: Revert back removed tests
Co-authored-by: Oleksandr Klymenko <[email protected]> Signed-off-by: Oleksandr Klymenko <[email protected]>
1 parent 92da20c commit e426a2d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

spring-ai-client-chat/src/test/java/org/springframework/ai/chat/client/DefaultChatClientTests.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,28 @@ void whenFunctionNameIsEmptyThenThrow() {
16831683
.build())).isInstanceOf(IllegalArgumentException.class).hasMessage("name cannot be null or empty");
16841684
}
16851685

1686+
@Test
1687+
@Disabled("This fails now as the FunctionToolCallback description is allowed to be empty")
1688+
void whenFunctionDescriptionIsNullThenThrow() {
1689+
ChatClient chatClient = new DefaultChatClientBuilder(mock(ChatModel.class)).build();
1690+
ChatClient.ChatClientRequestSpec spec = chatClient.prompt();
1691+
assertThatThrownBy(() -> spec.toolCallbacks(FunctionToolCallback.builder("name", input -> "hello")
1692+
.description(null)
1693+
.inputType(String.class)
1694+
.build())).isInstanceOf(IllegalArgumentException.class).hasMessage("Description must not be empty");
1695+
}
1696+
1697+
@Test
1698+
@Disabled("This fails now as the FunctionToolCallback description is allowed to be empty")
1699+
void whenFunctionDescriptionIsEmptyThenThrow() {
1700+
ChatClient chatClient = new DefaultChatClientBuilder(mock(ChatModel.class)).build();
1701+
ChatClient.ChatClientRequestSpec spec = chatClient.prompt();
1702+
assertThatThrownBy(() -> spec.toolCallbacks(
1703+
FunctionToolCallback.builder("name", input -> "hello").description("").inputType(String.class).build()))
1704+
.isInstanceOf(IllegalArgumentException.class)
1705+
.hasMessage("Description must not be empty");
1706+
}
1707+
16861708
@Test
16871709
void whenFunctionThenReturn() {
16881710
ChatClient chatClient = new DefaultChatClientBuilder(mock(ChatModel.class)).build();

0 commit comments

Comments
 (0)