Skip to content

Commit 25fccd8

Browse files
Konstantin PavlovKonstantin Pavlov
authored andcommitted
Fix log assertion in BeanOutputConverterTest to use Java 17
Updated the test to assert log size explicitly before accessing the first log entry. This ensures the test is more robust and avoids potential issues with accessing logs unexpectedly. Signed-off-by: Konstantin Pavlov <{ID}+{username}@users.noreply.github.com>
1 parent 62bdee2 commit 25fccd8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-ai-core/src/test/java/org/springframework/ai/converter/BeanOutputConverterTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ void convertClassType() {
158158
void failToConvertInvalidJson() {
159159
var converter = new BeanOutputConverter<>(TestClass.class);
160160
assertThatThrownBy(() -> converter.convert("{invalid json")).hasCauseInstanceOf(JsonParseException.class);
161-
final var loggingEvent = logAppender.list.getFirst();
161+
assertThat(logAppender.list).hasSize(1);
162+
final var loggingEvent = logAppender.list.get(0);
162163
assertThat(loggingEvent.getMessage()).isEqualTo(
163164
"Could not parse the given text to the desired target type:{invalid json into " + TestClass.class);
164165
assertThat(loggingEvent.getMarkerList()).contains(PII_MARKER);

0 commit comments

Comments
 (0)