Polishing

See gh-36972
This commit is contained in:
Sam Brannen
2026-06-27 15:19:42 +02:00
parent 872b1addeb
commit 78dcdab3fc
@@ -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);