Package de.cuioss.test.valueobjects
package de.cuioss.test.valueobjects
API
- See
de.cuioss.test.valueobjects.api
for the documentation of the api - See
ValueObjectTest
as entry point for the actual tests.
Examples
Minimum Bean Test
@VerifyBeanProperty
class SomeBeanTest extends ValueObjectTest<SomeBean>{...}
Two constructors but skip Object.toString()
test
@VerifyConstructor(of = "name", required = "name")
@VerifyConstructor(of = { "name", "number" }, required = { "name", "number" })
@VetoObjectTestContract(ObjectTestContracts.TO_STRING)
class SomeBeanTest extends ValueObjectTest<SomeBean>{...}
Factory method skip property-scanning, use own properties
In some cases the reflection-based scanning fails, usually if the objects in hand do not provide getter methods. In this case you can skip the scanning and add the properties manually. The required flag is defined at attribute level and will therefore inherited by the test.
@PropertyReflectionConfig(skip = true)
@PropertyConfig(name = "name", propertyClass = String.class, required = true)
@PropertyConfig(name = "number", propertyClass = Integer.class, required = true)
@VerifyFactoryMethod(of = { "name", "number" })
class SomeBeanTest extends ValueObjectTest<SomeBean>{...}
Builder using
PropertyGeneratorHint
@PropertyGeneratorHint(declaredType = Serializable.class, implementationType = String.class)
@VerifyBuilder
class SomeBeanTest extends ValueObjectTest<SomeBean>{...}
Builder using
PropertyGenerator
Synthetic example because
FloatObjectGenerator
is part of the
default generators that are already available
@PropertyGenerator(FloatObjectGenerator.class)
@VerifyBuilder
class SomeBeanTest extends ValueObjectTest<SomeBean>{...}
Hardcore internal example that covers many corner cases
@VetoObjectTestContract(ObjectTestContracts.SERIALIZABLE)
@VerifyBuilder
@PropertyReflectionConfig(required = { "name", "generator", "propertyClass" },
defaultValued = { "collectionType", "propertyMemberInfo", "propertyReadWrite", "propertyAccessStrategy" })
@ObjectTestConfig(equalsAndHashCodeExclude = "generator")
class PropertyMetadataImplTest extends ValueObjectTest<PropertyMetadataImpl> {...}
-
ClassesClassDescriptionAllows to test a mapper implementing a
Function
to map a (pseudo-)DTO object based on whatever technology (FHIR, ...) to a DTO object.Base class for dynamically testing properties.Base-class for running tests on value-objects.