Open
Description
In addition to the existing test scenario, it would be beneficial to add a new test case that validates the behavior when the Prompt
is null
. This is because when the messageType
is either MessageType.SYSTEM
or MessageType.USER
, the textContent
parameter cannot be null
, and an IllegalArgumentException
should be thrown in such cases.
//This is just a sample using AssertJ
@Test
void ThrowIllegalArgumentExceptionWhenPromptIsNull() {
contextRunner.run(context -> {
AnthropicChatModel chatModel = context.getBean(AnthropicChatModel.class);
assertThatThrownBy(() -> chatModel.call(null))
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("Content must not be null for SYSTEM or USER messages");
});
}