Class JodaBeanTests


  • public final class JodaBeanTests
    extends Object
    A utility class to assist with testing beans.

    Test coverage statistics can be heavily skewed by getters, setters and generated code. This class provides a solution, allowing bean test coverage to be artificially increased. Always remember that the goal of artificially increasing coverage is so that you can see what you really need to test, not to avoid writing tests altogether.

    • Field Detail

      • TEST_COVERAGE_PROPERTY

        public static final String TEST_COVERAGE_PROPERTY
        This constant can be used to pass to increase test coverage. This is used by some MetaBean methods in generated classes.
        See Also:
        Constant Field Values
      • TEST_COVERAGE_STRING

        public static final String TEST_COVERAGE_STRING
        This constant can be used to pass to increase test coverage. This is used by some BeanBuilder set methods in generated classes.
        See Also:
        Constant Field Values
    • Constructor Detail

      • JodaBeanTests

        public JodaBeanTests()
    • Method Detail

      • coverMutableBean

        public static void coverMutableBean​(Bean bean)
        Test a mutable bean for the primary purpose of increasing test coverage.
        Parameters:
        bean - the bean to test
      • coverImmutableBean

        public static void coverImmutableBean​(ImmutableBean bean)
        Test an immutable bean for the primary purpose of increasing test coverage.
        Parameters:
        bean - the bean to test
      • coverBeanEquals

        public static void coverBeanEquals​(Bean bean1,
                                           Bean bean2)
        Test a bean equals method for the primary purpose of increasing test coverage.

        The two beans passed in should contain a different value for each property. The method creates a cross-product to ensure test coverage of equals.

        Parameters:
        bean1 - the first bean to test
        bean2 - the second bean to test