File tree Expand file tree Collapse file tree
spring-core/src/test/java/org/springframework/aot/nativex/feature Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public InputStream getResourceAsStream(String name) {
5757 assertThat (closed ).as ("InputStream closed" ).isTrue ();
5858 }
5959
60- @ Test
60+ @ Test // gh-36938
6161 void loadClassThrowsClassNotFoundExceptionWhenClassResourceIsMissing () {
6262 // The grandparent resolves bootstrap classes only, so super.loadClass(...) fails,
6363 // and the resource loader provides no class bytes. The fallback must then honor the
@@ -70,10 +70,13 @@ public InputStream getResourceAsStream(String name) {
7070 };
7171 ThrowawayClassLoader classLoader = new ThrowawayClassLoader (resourceLoader );
7272
73+ String name = "com.example.MissingClass" ;
7374 assertThatExceptionOfType (ClassNotFoundException .class )
74- .isThrownBy (() -> classLoader .loadClass ("com.example.MissingClass" ));
75+ .isThrownBy (() -> classLoader .loadClass (name ))
76+ .withMessageContaining (name );
7577 }
7678
79+
7780 private static byte [] classBytesOf (String className ) throws IOException {
7881 String resourceName = className .replace ('.' , '/' ) + ".class" ;
7982 try (InputStream in = ThrowawayClassLoaderTests .class .getClassLoader ().getResourceAsStream (resourceName )) {
You can’t perform that action at this time.
0 commit comments