Class AbstractBindingResultAssert<SELF extends AbstractBindingResultAssert<SELF>>

java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,BindingResult>
org.springframework.test.validation.AbstractBindingResultAssert<SELF>
Type Parameters:
SELF - the type of assertions
All Implemented Interfaces:
org.assertj.core.api.Assert<SELF,BindingResult>, org.assertj.core.api.Descriptable<SELF>, org.assertj.core.api.ExtensionPoints<SELF,BindingResult>

public abstract class AbstractBindingResultAssert<SELF extends AbstractBindingResultAssert<SELF>> extends org.assertj.core.api.AbstractAssert<SELF,BindingResult>
AssertJ assertions that can be applied to BindingResult.
Since:
6.2
Author:
Stephane Nicoll
  • Field Summary

    Fields inherited from class org.assertj.core.api.AbstractAssert

    actual, info, myself, objects, throwUnsupportedExceptionOnEquals
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractBindingResultAssert(String name, BindingResult bindingResult, Class<?> selfType)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    hasErrorsCount(int expected)
    Verify that the total number of errors is equal to the expected value.
    hasFieldErrorCode(String fieldName, String errorCode)
    Verify that the field with the given fieldName has an error matching the given errorCode.
    hasFieldErrors(String... fieldNames)
    Verify that the actual binding result contains fields in error with the given fieldNames.
    hasOnlyFieldErrors(String... fieldNames)
    Verify that the actual binding result contains only fields in error with the given fieldNames, and nothing else.
    protected AssertionError
    unexpectedBindingResult(String reason, Object... arguments)
     

    Methods inherited from class org.assertj.core.api.AbstractAssert

    areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnError

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.assertj.core.api.Descriptable

    as, as, as, describedAs, describedAs
  • Constructor Details

    • AbstractBindingResultAssert

      protected AbstractBindingResultAssert(String name, BindingResult bindingResult, Class<?> selfType)
  • Method Details

    • hasErrorsCount

      public SELF hasErrorsCount(int expected)
      Verify that the total number of errors is equal to the expected value.
      Parameters:
      expected - the expected number of errors
    • hasFieldErrors

      public SELF hasFieldErrors(String... fieldNames)
      Verify that the actual binding result contains fields in error with the given fieldNames.
      Parameters:
      fieldNames - the names of fields that should be in error
    • hasOnlyFieldErrors

      public SELF hasOnlyFieldErrors(String... fieldNames)
      Verify that the actual binding result contains only fields in error with the given fieldNames, and nothing else.
      Parameters:
      fieldNames - the exhaustive list of field names that should be in error
    • hasFieldErrorCode

      public SELF hasFieldErrorCode(String fieldName, String errorCode)
      Verify that the field with the given fieldName has an error matching the given errorCode.
      Parameters:
      fieldName - the name of a field in error
      errorCode - the error code for that field
    • unexpectedBindingResult

      protected AssertionError unexpectedBindingResult(String reason, Object... arguments)