From 06a39f166e56d2d93ba19acf043f2c604612adec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Tue, 20 Feb 2024 10:19:19 +0100 Subject: [PATCH] Consistent handling of AssertProvider implementations --- .../aot/test/agent/RuntimeHintsInvocations.java | 6 +++++- .../springframework/core/test/tools/ResourceFile.java | 8 +++----- .../org/springframework/core/test/tools/SourceFile.java | 8 +++----- .../core/test/tools/ResourceFileTests.java | 9 ++++----- .../springframework/core/test/tools/SourceFileTests.java | 7 +++---- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocations.java b/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocations.java index 984d865a50..6e21b07845 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocations.java +++ b/spring-core-test/src/main/java/org/springframework/aot/test/agent/RuntimeHintsInvocations.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,10 @@ public class RuntimeHintsInvocations implements AssertProvider appendable.append("test")); + assertThat(file).hasContent("test"); } } diff --git a/spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFileTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFileTests.java index 5280c9f795..488806af31 100644 --- a/spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFileTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFileTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -106,10 +106,9 @@ class SourceFileTests { } @Test - @SuppressWarnings("deprecation") - void assertThatReturnsAssert() { + void assertThatUseSourceFileAssert() { SourceFile sourceFile = SourceFile.of(HELLO_WORLD); - assertThat(sourceFile.assertThat()).isInstanceOf(SourceFileAssert.class); + assertThat(sourceFile).hasContent(HELLO_WORLD); } @Test