Class ShouldOnlyHaveFields

  • All Implemented Interfaces:
    ErrorMessageFactory

    public class ShouldOnlyHaveFields
    extends BasicErrorMessageFactory
    Creates an error message indicating that an assertion that verifies that a class has only the fields.
    Author:
    Filip Hrisafov
    • Method Detail

      • shouldOnlyHaveFields

        public static ErrorMessageFactory shouldOnlyHaveFields​(Class<?> actual,
                                                               Collection<String> expected,
                                                               Collection<String> notFound,
                                                               Collection<String> notExpected)
        Creates a new ShouldOnlyHaveFields.
        Parameters:
        actual - the actual value in the failed assertion.
        expected - expected fields for this class
        notFound - fields in expected not found in the actual.
        notExpected - fields in the actual that were not in expected.
        Returns:
        the created ErrorMessageFactory.
      • shouldOnlyHaveDeclaredFields

        public static ErrorMessageFactory shouldOnlyHaveDeclaredFields​(Class<?> actual,
                                                                       Collection<String> expected,
                                                                       Collection<String> notFound,
                                                                       Collection<String> notExpected)
        Creates a new ShouldOnlyHaveFields.
        Parameters:
        actual - the actual value in the failed assertion.
        expected - expected fields for this class
        notFound - fields in expected not found in the actual.
        notExpected - fields in the actual that were not in expected.
        Returns:
        the created ErrorMessageFactory.