Skip to content

Add a new test case for AnthropicAutoConfigurationIT. Considering call(null). #1517

Open
@jonatasemidio

Description

@jonatasemidio

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");
    });
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions