Introduce complete DefaultGenerationContext constructor

Prior to this commit, it was possible to create a DefaultGenerationContext
based on a ClassNameGenerator and GeneratedFiles; however, there was no way
to create a DefaultGenerationContext that reused an existing RuntimeHints
instance which is necessary in certain use cases -- for example, in the
TestContext framework where multiple GenerationContexts are created
based on shared instances of GeneratedFiles and RuntimeHints.

This commit addresses this by introducing a public
DefaultGenerationContext(ClassNameGenerator,GeneratedFiles,RuntimeHints)
constructor.
This commit is contained in:
Sam Brannen
2022-08-15 18:21:50 +02:00
parent 40de029bf8
commit 9ab046bdbb
2 changed files with 18 additions and 3 deletions

View File

@@ -66,8 +66,8 @@ class DefaultGenerationContextTests {
@Test
void createWhenGeneratedClassesIsNullThrowsException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new DefaultGenerationContext(null, this.generatedFiles,
this.runtimeHints))
.isThrownBy(() -> new DefaultGenerationContext((GeneratedClasses) null,
this.generatedFiles, this.runtimeHints))
.withMessage("'generatedClasses' must not be null");
}