Package de.cuioss.test.valueobjects.util
Class GeneratorAnnotationHelper
java.lang.Object
de.cuioss.test.valueobjects.util.GeneratorAnnotationHelper
Provides utility methods for dealing with the creation of
TypedGenerator
usually in conjunction with annotations- Author:
- Oliver Wolff
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Set<PropertyGeneratorHint>
extractConfiguredGeneratorHints
(Class<?> annotated) Checks the given type for the annotationPropertyGeneratorHint
andPropertyGeneratorHints
and puts all found in the returned liststatic Set<PropertyGenerator>
extractConfiguredPropertyGenerator
(Class<?> annotated) Checks the given type for the annotationPropertyGenerator
andPropertyGenerators
and puts all found in the returned liststatic void
handleGeneratorHints
(Class<?> annotated) Checks the given type for the annotationPropertyGeneratorHint
andPropertyGeneratorHints
and registers all found to theTypedGeneratorRegistry
static void
handleGeneratorsForTestClass
(Object testClass, List<de.cuioss.test.generator.TypedGenerator<?>> additionalGenerator) Convenience method for handling all Generator specific aspects like initially callingTypedGeneratorRegistry.registerBasicTypes()
and calling of the individual registering methods likehandleUnitClassImplementation(Object)
,handlePropertyGenerator(Class)
andhandleGeneratorHints(Class)
in case there are additionalGenerator given they will be registered as wellstatic void
handlePropertyGenerator
(Class<?> annotated) Checks the given type for the annotationPropertyGenerator
andPropertyGenerators
and registers all found to theTypedGeneratorRegistry
static void
handleUnitClassImplementation
(Object testClass) Checks whether the actual implementation of the test implementsTypedGenerator
.
-
Field Details
-
UNABLE_TO_INSTANTIATE_GENERATOR
- See Also:
-
-
Constructor Details
-
GeneratorAnnotationHelper
public GeneratorAnnotationHelper()
-
-
Method Details
-
handleGeneratorsForTestClass
public static void handleGeneratorsForTestClass(Object testClass, List<de.cuioss.test.generator.TypedGenerator<?>> additionalGenerator) Convenience method for handling all Generator specific aspects like initially callingTypedGeneratorRegistry.registerBasicTypes()
and calling of the individual registering methods likehandleUnitClassImplementation(Object)
,handlePropertyGenerator(Class)
andhandleGeneratorHints(Class)
in case there are additionalGenerator given they will be registered as well- Parameters:
testClass
- must not nulladditionalGenerator
-
-
handleGeneratorHints
Checks the given type for the annotationPropertyGeneratorHint
andPropertyGeneratorHints
and registers all found to theTypedGeneratorRegistry
- Parameters:
annotated
- the class that may or may not provide the annotations, must not be null
-
handlePropertyGenerator
Checks the given type for the annotationPropertyGenerator
andPropertyGenerators
and registers all found to theTypedGeneratorRegistry
- Parameters:
annotated
- the class that may or may not provide the annotations, must not be null
-
handleUnitClassImplementation
Checks whether the actual implementation of the test implementsTypedGenerator
. If so it will be registered to theTypedGeneratorRegistry
- Parameters:
testClass
- the actual test-object
-
extractConfiguredGeneratorHints
Checks the given type for the annotationPropertyGeneratorHint
andPropertyGeneratorHints
and puts all found in the returned list- Parameters:
annotated
- the class that may or may not provide the annotations, must not be null- Returns:
- a
Set
ofVerifyConstructor
extracted from the annotations of the given type. May be empty but never null
-
extractConfiguredPropertyGenerator
Checks the given type for the annotationPropertyGenerator
andPropertyGenerators
and puts all found in the returned list- Parameters:
annotated
- the class that may or may not provide the annotations, must not be null- Returns:
- a
Set
ofPropertyGenerator
extract from the annotations of the given type. May be empty but never null
-