Class BeanTester

java.lang.Object
nl._42.beanie.tester.BeanTester

public class BeanTester extends Object
Verifies the getter and setter methods of beans. The retrieved value should be semantically equal to the initially set value.
Author:
Jeroen van Schagen
  • Constructor Details

  • Method Details

    • verifyBeans

      public int verifyBeans(Class<?> basePackageClass)
      Verify the getter and setters of each bean classes, declared in the same package, or child packages, as the specified class.
      Parameters:
      basePackageClass - the base package class
      Returns:
      the number of verified beans
    • verifyBeans

      public int verifyBeans(String basePackage)
      Verify the getter and setters of each bean classes, declared in the specified package, or child packages.
      Parameters:
      basePackage - the base package to search for beans
      Returns:
      the number of verified beans
    • verifyBean

      public void verifyBean(Class<?> beanClass)
      Verify the getter and setters of the specified bean.
      Parameters:
      beanClass - the bean class
      Throws:
      InconsistentGetterAndSetterException - whenever an inconsistency was found
    • verifyProperty

      public void verifyProperty(Class<?> beanClass, String propertyName)
      Verify the getter and setter of a property.
      Parameters:
      beanClass - the bean class
      propertyName - the property name
    • include

      public BeanTester include(org.springframework.core.type.filter.TypeFilter filter)
      Add an inclusion filter.
      Parameters:
      filter - the filter
      Returns:
      this instance for chaining
    • includeAllWithNullaryConstructor

      public BeanTester includeAllWithNullaryConstructor()
      Include all beans with a nullary constructor.
      Returns:
      this instance for chaining
    • includeAll

      public BeanTester includeAll()
      Include all beans.
      Returns:
      this instance for chaining
    • exclude

      public BeanTester exclude(org.springframework.core.type.filter.TypeFilter filter)
      Add an exclusion filter.
      Parameters:
      filter - the filter
      Returns:
      this instance for chaining
    • exclude

      public BeanTester exclude(String pattern)
      Excludes a pattern from testing.
      Parameters:
      pattern - the pattern
      Returns:
      this instance for chaining
    • exclude

      public BeanTester exclude(Class<?> beanClass)
      Excludes a class from testing.
      Parameters:
      beanClass - the bean class
      Returns:
      this instance for chaining
    • exclude

      public BeanTester exclude(Class<?> declaringClass, String propertyName)
      Excludes a property from testing.
      Parameters:
      declaringClass - the declaring class
      propertyName - name of the property
      Returns:
      this instance for chaining
    • inherit

      public BeanTester inherit(boolean inherit)
      If we should also test the parent properties.
      Parameters:
      inherit - to inherit
      Returns:
      this instance for chaining