From 8115c433795c306e03a11d6f0c81bf4359332310 Mon Sep 17 00:00:00 2001 From: PiotrFLEURY Date: Wed, 15 Nov 2023 19:01:02 +0100 Subject: [PATCH] Add className value to error message --- .../java/org/springframework/aot/generate/GeneratedFiles.java | 2 +- .../org/springframework/aot/generate/GeneratedFilesTests.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/aot/generate/GeneratedFiles.java b/spring-core/src/main/java/org/springframework/aot/generate/GeneratedFiles.java index 411ec8b46baf..f1ae40ddf0fd 100644 --- a/spring-core/src/main/java/org/springframework/aot/generate/GeneratedFiles.java +++ b/spring-core/src/main/java/org/springframework/aot/generate/GeneratedFiles.java @@ -161,7 +161,7 @@ default void addFile(Kind kind, String path, ThrowingConsumer conten private static String getClassNamePath(String className) { Assert.hasLength(className, "'className' must not be empty"); - Assert.isTrue(isJavaIdentifier(className), "'className' must be a valid identifier"); + Assert.isTrue(isJavaIdentifier(className), "'className' " + className + " must be a valid identifier"); return ClassUtils.convertClassNameToResourcePath(className) + ".java"; } diff --git a/spring-core/src/test/java/org/springframework/aot/generate/GeneratedFilesTests.java b/spring-core/src/test/java/org/springframework/aot/generate/GeneratedFilesTests.java index 9f1f68ef3097..4f13505a7b5a 100644 --- a/spring-core/src/test/java/org/springframework/aot/generate/GeneratedFilesTests.java +++ b/spring-core/src/test/java/org/springframework/aot/generate/GeneratedFilesTests.java @@ -78,7 +78,7 @@ void addSourceFileWithCharSequenceWhenClassNameIsInvalidThrowsException() { assertThatIllegalArgumentException() .isThrownBy(() -> this.generatedFiles .addSourceFile("com/example/HelloWorld.java", "{}")) - .withMessage("'className' must be a valid identifier"); + .withMessage("'className' com/example/HelloWorld.java must be a valid identifier"); } @Test