Powerunit - Java Testing framework for JDK 1.8 - Extension to provide matchers based on annotations. 1.0.0 API
This is an extension to Powerunit to generate matchers for POJO.
This library provides several annotation processors :
- Processing of the ProvideMatchers annotation.
This processor createMatcher
for each annotated class, in the following way :- For public field, create a dedicated matcher, accessing this field by using direct access.
- For method named getXXX, which haven't any parameter and return something, assume this is a field and create a dedicated matcher, accessing it by using this method.
- For method named isXXX, which haven't any parameter and return something, assume this is a field and create a dedicated matcher, accessing it by using this method.
- If this class extends another one (outside Object), a special matcher will be created to check the super class information.
- Create one (or two if a super class exists) methods to build the matcher. These method are named based on the class name, followed by with.
- Create dedicated method to compare, using matcher, on object with another.
- For some specific type, add method to do some matching with more clean name, like XXXIsPresent for an Optional.
- If some library are available, add special matchers.
- Generating class with all the matchers, directly
during annotation processing
This processor requires to set the parameterch.powerunit.extensions.matchers.provideprocessor.ProvidesMatchersAnnotationsProcessor.factory
(-A
parameter).
This processor createDSL
interface for each factory method of the matchers, in the interface defined by this parameter.
javax.annotation.Generated
is not
available OOTB with recent version of java. You may need to add a
dependency providing it if necessary.
The hamcrest library is required by this annotation processor and the generated classes.
Module
Description
This is the module containing all the support for the powerunit matchers.