Top Fields Constructors Methods
org.hamcrest.text

public Class MatchesPattern

extends TypeSafeMatcher<String>
Class Inheritance
Imports
org.hamcrest.Description, .Matcher, .TypeSafeMatcher, java.util.regex.Pattern

Field Summary

Modifier and TypeField and Description
private final Pattern

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
describeTo(Description
The description to be built or appended to.
description
)

Implements org.hamcrest.SelfDescribing.describeTo.

Generates a description of the object.
public static Matcher<String>
matchesPattern(Pattern pattern)

Creates a matcher of java.lang.String that matches when the examined string exactly matches the given java.util.regex.Pattern.

public static Matcher<String>
matchesPattern(String regex)

Creates a matcher of java.lang.String that matches when the examined string exactly matches the given regular expression, treated as a java.util.regex.Pattern.

protected boolean
matchesSafely(String item)

Implements abstract org.hamcrest.TypeSafeMatcher.matchesSafely.

Subclasses should implement this.
Inherited from org.hamcrest.TypeSafeMatcher:
describeMismatchdescribeMismatchSafelymatches

Field Detail

patternback to summary
private final Pattern pattern

Constructor Detail

MatchesPatternback to summary
public MatchesPattern(Pattern pattern)

Method Detail

describeToback to summary
public void describeTo(Description description)

Implements org.hamcrest.SelfDescribing.describeTo.

Doc from org.hamcrest.SelfDescribing.describeTo.

Generates a description of the object. The description may be part of a a description of a larger object of which this is just a component, so it should be worded appropriately.

Parameters
description:Description

The description to be built or appended to.

Annotations
@Override
matchesPatternback to summary
public static Matcher<String> matchesPattern(Pattern pattern)

Creates a matcher of java.lang.String that matches when the examined string exactly matches the given java.util.regex.Pattern.

matchesPatternback to summary
public static Matcher<String> matchesPattern(String regex)

Creates a matcher of java.lang.String that matches when the examined string exactly matches the given regular expression, treated as a java.util.regex.Pattern.

matchesSafelyback to summary
protected boolean matchesSafely(String item)

Implements abstract org.hamcrest.TypeSafeMatcher.matchesSafely.

Doc from org.hamcrest.TypeSafeMatcher.matchesSafely.

Subclasses should implement this. The item will already have been checked for the specific type and will never be null.

Annotations
@Override