Annotation Interface VerifyBuilder


If used on ValueObjectTest this test checks / tests builder of value objects.

As default the test assumes a static factory method with the name "builder", e.g. PropertyMetadataImpl.builder() being present on the type to be tested. This can be controlled using builderFactoryMethodName(), builderFactoryProvidingClass() and builderMethodName(). In case you have a builder that can be instantiated directly by using a no-args public constructor directly you can use builderClass() instead.

The builder methods for the individual properties are assumed to use the property-name only as method-name, e.g. PropertyMetadataImpl.PropertyMetadataBuilder.propertyClass(Class). In case you prefer a prefix you can either configure it using methodPrefix() or can do some more fine grained configuration with PropertyBuilderConfig

Author:
Oliver Wolff
  • Element Details

    • builderFactoryMethodName

      Returns:
      the name of the factory method for creating the builder instances. It is assumed that it is parameter-free static method. If not set it defaults to "builder"
      Default:
      "builder"
    • builderMethodName

      Returns:
      the name of the build method on the builderClass(). It is assumed that it is parameter-free method on the builderType and returns instances of the type on unit class level of ValueObjectTest. Defaults to "build"
      Default:
      "build"
    • builderClass

      This attribute defines the actual type of the concrete builder. The default value VerifyBuilder acts as null value. If it is set it will be used instead of any factory. It is assumed to have a no args public constructor.
      Returns:
      the builder-class
      Default:
      de.cuioss.test.valueobjects.api.contracts.VerifyBuilder.class
    • builderFactoryProvidingClass

      Optional attribute. The default assumes that the factory method for creating the concrete builder is located at the object under test. This method is only necessary if it is located on another type, e.g the actual unit-test-class. The default value VerifyBuilder acts as null value
      Returns:
      the type where the builderFactoryMethod is defined, the name of this method is defined within builderFactoryMethodName()
      Default:
      de.cuioss.test.valueobjects.api.contracts.VerifyBuilder.class
    • exclude

      Returns:
      an array of properties, identified by their names that are not to be considered for this test: black-list
      Default:
      {}
    • of

      Returns:
      an array of properties, identified by their names that are to be considered for this test: white-list
      Default:
      {}
    • required

      Returns:
      an array of properties, identified by their names that are to be treated as required properties, see PropertyMetadata.isRequired()
      Default:
      {}
    • transientProperties

      Returns:
      an array of properties, identified by their names that are to be treated as transient properties, see PropertyMemberInfo.TRANSIENT
      Default:
      {}
    • defaultValued

      Returns:
      an array of properties, identified by their names that are to be treated as having a default values, see PropertyMetadata.isDefaultValue()
      Default:
      {}
    • readOnly

      Returns:
      an array of properties, identified by their names that are to be treated as being read-only, see PropertyReadWrite.READ_ONLY, usually used in conjunction with defaultValued()
      Default:
      {}
    • writeOnly

      Returns:
      an array of properties, identified by their names that are to be treated as being write-only, see PropertyReadWrite.WRITE_ONLY, usually used in cases where a property to be written will result in other properties but itself can not be accessed directly
      Default:
      {}
    • assertUnorderedCollection

      Returns:
      an array of properties, identified by their names representing at least a Collection that are to be asserted ignoring the concrete order, see PropertyConfig.assertionStrategy() and AssertionStrategy.COLLECTION_IGNORE_ORDER. The default implementation will always respect / assert the same order of elements.
      Default:
      {}
    • methodPrefix

      In case methodPrefix is not set the corresponding build method to be accessed for setting the value is the name of the attribute: propertyName(), in case it is a concrete value, e.g. 'with' it will taken into account: withPropertName().
      Returns:
      the method prefix, defaults to empty string
      Default:
      ""