Class ConstraintAsserts

java.lang.Object
com.totvs.tjf.test.support.ConstraintAsserts

public final class ConstraintAsserts extends Object
Asserts helper to validates bean instances using a fluent api.
  • Method Details

    • assertThatViolationsFor

      public static <T> ConstraintAsserts.AssertConstraint<T> assertThatViolationsFor(@NonNull T object, Class<?>... groups)
      Validates all constraints on object and build an instance of ConstraintAsserts to assert the violations for the supplied object.
      Type Parameters:
      T - the type of the object to validate.
      Parameters:
      object - to validate.
      groups - the group or list of groups targeted for validation (defaults to Default).
      Returns:
      com.totvs.tjf.test.support.AssertConstraint
      Throws:
      javax.validation.ValidationException - if a non recoverable error happens during the validation process.
    • assertThatViolationsFor

      public static <T> ConstraintAsserts.AssertConstraint<T> assertThatViolationsFor(@NonNull T object, @NonNull String property, Class<?>... groups)
      Validates all constraints placed on the property of object and build an instance of ConstraintAsserts to assert the violations for the supplied object.
      Type Parameters:
      T - the type of the object to validate.
      Parameters:
      object - to validate.
      property - in the object to validate.
      groups - the group or list of groups targeted for validation (defaults to Default).@param property
      Returns:
      com.totvs.tjf.test.support.AssertConstraint
      Throws:
      javax.validation.ValidationException - if a non recoverable error happens during the validation process.