From 78dcdab3fc86365c77477e666600bb175e118f9a Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Sat, 27 Jun 2026 15:19:42 +0200 Subject: [PATCH] Polishing See gh-36972 --- .../FileNativeConfigurationWriterTests.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spring-core/src/test/java/org/springframework/aot/nativex/FileNativeConfigurationWriterTests.java b/spring-core/src/test/java/org/springframework/aot/nativex/FileNativeConfigurationWriterTests.java index 3a0ad7cecd7..834c2c962b7 100644 --- a/spring-core/src/test/java/org/springframework/aot/nativex/FileNativeConfigurationWriterTests.java +++ b/spring-core/src/test/java/org/springframework/aot/nativex/FileNativeConfigurationWriterTests.java @@ -24,7 +24,6 @@ import java.nio.file.Path; import java.util.function.Consumer; import java.util.function.Function; -import org.json.JSONException; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.skyscreamer.jsonassert.JSONAssert; @@ -64,7 +63,7 @@ class FileNativeConfigurationWriterTests { } @Test - void serializationConfig() throws IOException, JSONException { + void serializationConfig() throws Exception { FileNativeConfigurationWriter generator = new FileNativeConfigurationWriter(tempDir); RuntimeHints hints = new RuntimeHints(); ReflectionHints reflectionHints = hints.reflection(); @@ -82,7 +81,7 @@ class FileNativeConfigurationWriterTests { } @Test - void proxyConfig() throws IOException, JSONException { + void proxyConfig() throws Exception { FileNativeConfigurationWriter generator = new FileNativeConfigurationWriter(tempDir); RuntimeHints hints = new RuntimeHints(); ProxyHints proxyHints = hints.proxies(); @@ -100,7 +99,7 @@ class FileNativeConfigurationWriterTests { } @Test - void reflectionConfig() throws IOException, JSONException { + void reflectionConfig() throws Exception { FileNativeConfigurationWriter generator = new FileNativeConfigurationWriter(tempDir); RuntimeHints hints = new RuntimeHints(); ReflectionHints reflectionHints = hints.reflection(); @@ -139,7 +138,7 @@ class FileNativeConfigurationWriterTests { } @Test - void jniConfig() throws IOException, JSONException { + void jniConfig() throws Exception { // same format as reflection so just test basic file generation FileNativeConfigurationWriter generator = new FileNativeConfigurationWriter(tempDir); RuntimeHints hints = new RuntimeHints(); @@ -158,7 +157,7 @@ class FileNativeConfigurationWriterTests { } @Test - void resourceConfig() throws IOException, JSONException { + void resourceConfig() throws Exception { FileNativeConfigurationWriter generator = new FileNativeConfigurationWriter(tempDir); RuntimeHints hints = new RuntimeHints(); ResourceHints resourceHints = hints.resources(); @@ -177,7 +176,7 @@ class FileNativeConfigurationWriterTests { }"""); } - @Test + @Test // gh-36972 void resourceConfigWithNonAsciiPatternIsWrittenAsUtf8() throws IOException { FileNativeConfigurationWriter generator = new FileNativeConfigurationWriter(tempDir); RuntimeHints hints = new RuntimeHints(); @@ -202,7 +201,8 @@ class FileNativeConfigurationWriterTests { assertThat(jsonFile.toFile()).exists(); } - private void assertEquals(String expectedString) throws IOException, JSONException { + + private static void assertEquals(String expectedString) throws Exception { Path jsonFile = tempDir.resolve("META-INF").resolve("native-image").resolve("reachability-metadata.json"); String content = Files.readString(jsonFile); JSONAssert.assertEquals(expectedString, content, JSONCompareMode.NON_EXTENSIBLE);