From c5fc0a5ef3fb85a69fd8d9f92c86a2798344df98 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 28 Sep 2022 11:20:35 +0200 Subject: [PATCH] Add shortcut in TestGenerationContext --- .../aot/test/generate/TestGenerationContext.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/TestGenerationContext.java b/spring-core-test/src/main/java/org/springframework/aot/test/generate/TestGenerationContext.java index 77b19e10a1..859d2db341 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/TestGenerationContext.java +++ b/spring-core-test/src/main/java/org/springframework/aot/test/generate/TestGenerationContext.java @@ -51,12 +51,21 @@ public class TestGenerationContext extends DefaultGenerationContext implements U /** * Create an instance using the specified {@code target}. - * @param target the default target class to use + * @param target the default target class name to use */ public TestGenerationContext(ClassName target) { this(new ClassNameGenerator(target)); } + /** + * Create an instance using the specified {@code target}. + * @param target the default target class to use + */ + public TestGenerationContext(Class target) { + this(ClassName.get(target)); + } + + /** * Create an instance using {@link #TEST_TARGET} as the {@code target}. */