Top Description Fields Constructors Methods
org.assertj.core.api

public abstract Class AbstractMatcherAssert<SELF extends AbstractMatcherAssert<SELF>>

extends AbstractAssert<SELF extends AbstractMatcherAssert<SELF>, Matcher>
Class Inheritance
Known Direct Subclasses
org.assertj.core.api.MatcherAssert
Static Imports
org.assertj.core.error.MatcherShouldMatch.shouldMatch

Assertions for java.util.regex.Matcher
Author
Jiashu Zhang

Field Summary

Inherited from org.assertj.core.api.AbstractAssert:
actualassertionErrorCreatorconditionscustomRepresentationinfomyselfobjectsprintAssertionsDescriptionthrowUnsupportedExceptionOnEquals

Constructor Summary

AccessConstructor and Description
protected
AbstractMatcherAssert(Matcher actual, Class<?> selfType)

Method Summary

Modifier and TypeMethod and Description
public SELF

Returns:

this assertion object.
matches
()

Verifies that the Matcher matches.

Inherited from org.assertj.core.api.AbstractAssert:
areEqualasInstanceOfasListassertionErrorasStringdescribedAsdescriptionTextdoesNotHavedoesNotHaveSameClassAsdoesNotHaveSameHashCodeAsdoesNotHaveToStringdoesNotHaveToStringequalsextractingextractingfailurefailureWithActualExpectedfailWithActualExpectedAndMessagefailWithMessagegetWritableAssertionInfohashashCodehasSameClassAshasSameHashCodeAshasToStringhasToStringinBinaryinHexadecimalisisElementOfCustomAssertisEqualToisExactlyInstanceOfisInisInisInstanceOfisInstanceOfAnyisInstanceOfSatisfyingisNotisNotEqualToisNotExactlyInstanceOfisNotInisNotInisNotInstanceOfisNotInstanceOfAnyisNotNullisNotOfAnyClassInisNotSameAsisNullisOfAnyClassInisSameAsmatchesmatchesnewListAssertInstanceoverridingErrorMessageoverridingErrorMessagesatisfiessatisfiessatisfiessatisfiesAnyOfsatisfiesAnyOfsatisfiesAnyOfForProxysatisfiesForProxysetCustomRepresentationsetDescriptionConsumersetPrintAssertionsDescriptionthrowAssertionErrorusingComparatorusingComparatorusingDefaultComparatorusingRecursiveAssertionusingRecursiveAssertionusingRecursiveComparisonusingRecursiveComparisonwithAssertionStatewithFailMessagewithFailMessagewithRepresentationwithThreadDumpOnError

Constructor Detail

AbstractMatcherAssertback to summary
protected AbstractMatcherAssert(Matcher actual, Class<?> selfType)

Method Detail

matchesback to summary
public SELF matches()

Verifies that the Matcher matches.

Example:

 // Assertion succeeds:
Pattern pattern = Pattern.compile("a*");
Matcher matcher = pattern.matcher("aaa");
assertThat(matcher).matches();

// Assertion fails:
Pattern pattern = Pattern.compile("a*");
Matcher matcher = pattern.matcher("abc");
assertThat(matcher).matches();
Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if actual does not match.
  • if actual is null.
Since
3.23.0