Class ThrowableIsCausedByMatcher
- java.lang.Object
-
- ru.tinkoff.qa.neptune.core.api.steps.SelfDescribed
-
- ru.tinkoff.qa.neptune.core.api.hamcrest.NeptuneFeatureMatcher<Throwable>
-
- ru.tinkoff.qa.neptune.core.api.hamcrest.throwable.ThrowableIsCausedByMatcher
-
- All Implemented Interfaces:
org.hamcrest.Matcher<Throwable>
,org.hamcrest.SelfDescribing
public abstract class ThrowableIsCausedByMatcher extends NeptuneFeatureMatcher<Throwable>
-
-
Field Summary
-
Fields inherited from class ru.tinkoff.qa.neptune.core.api.hamcrest.NeptuneFeatureMatcher
expectedTypes, isNullSafe, mismatchDescriptions
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
featureMatches(Throwable toMatch)
static <T extends Throwable>
ThrowableIsCausedByMatcherhasPrimaryCause(Class<T> expectedClass)
Defines expected class ofThrowable
which is taken viaThrowable.getCause()
of the verified throwablestatic <T extends Throwable>
ThrowableIsCausedByMatcherhasPrimaryCause(Class<T> expectedClass, String message)
Defines expected class and message ofThrowable
which is taken viaThrowable.getCause()
of the verified throwablestatic <T extends Throwable>
ThrowableIsCausedByMatcherhasPrimaryCause(Class<T> expectedClass, org.hamcrest.Matcher<? super String>... messageMatchers)
Defines expected class and message criteria ofThrowable
which is taken viaThrowable.getCause()
of the verified throwablestatic ThrowableIsCausedByMatcher
hasPrimaryCause(org.hamcrest.Matcher<? super Throwable>... matchers)
Defines criteria to checkThrowable
which is taken viaThrowable.getCause()
of the verified throwablestatic <T extends Throwable>
ThrowableIsCausedByMatcherhasRootCause(Class<T> expectedClass)
Defines expected class to find any suitable throwable-cause of the verified throwablestatic <T extends Throwable>
ThrowableIsCausedByMatcherhasRootCause(Class<T> expectedClass, String message)
Defines expected class and message to find any suitable throwable-cause of the verified throwablestatic <T extends Throwable>
ThrowableIsCausedByMatcherhasRootCause(Class<T> expectedClass, org.hamcrest.Matcher<? super String>... messageMatchers)
Defines expected class and message criteria to find any suitable throwable-cause of the verified throwablestatic ThrowableIsCausedByMatcher
hasRootCause(org.hamcrest.Matcher<? super Throwable>... matchers)
Defines criteria to find any suitable throwable-cause of the verified throwable-
Methods inherited from class ru.tinkoff.qa.neptune.core.api.hamcrest.NeptuneFeatureMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, appendMismatchDescription, appendMismatchDescription, appendMismatchDescription, checkFeature, concatMatcherDescriptions, concatMatcherDescriptions, describeMismatch, describeTo, matches, prerequisiteChecking
-
Methods inherited from class ru.tinkoff.qa.neptune.core.api.steps.SelfDescribed
toString
-
-
-
-
Method Detail
-
hasPrimaryCause
@SafeVarargs public static ThrowableIsCausedByMatcher hasPrimaryCause(org.hamcrest.Matcher<? super Throwable>... matchers)
Defines criteria to checkThrowable
which is taken viaThrowable.getCause()
of the verified throwable- Parameters:
matchers
- criteria to check throwable- Returns:
- an instance of
ThrowableIsCausedByMatcher
that checks only first cause taken viaThrowable.getCause()
of the verified throwable
-
hasPrimaryCause
public static <T extends Throwable> ThrowableIsCausedByMatcher hasPrimaryCause(Class<T> expectedClass)
Defines expected class ofThrowable
which is taken viaThrowable.getCause()
of the verified throwable- Type Parameters:
T
- is a type of throwable-cause- Parameters:
expectedClass
- is expected class of throwable-cause- Returns:
- an instance of
ThrowableIsCausedByMatcher
that checks only first cause taken viaThrowable.getCause()
of the verified throwable
-
hasPrimaryCause
public static <T extends Throwable> ThrowableIsCausedByMatcher hasPrimaryCause(Class<T> expectedClass, String message)
Defines expected class and message ofThrowable
which is taken viaThrowable.getCause()
of the verified throwable- Type Parameters:
T
- is a type of throwable-cause- Parameters:
expectedClass
- is expected class of throwable-causemessage
- is expected message of throwable-cause- Returns:
- an instance of
ThrowableIsCausedByMatcher
that checks only first cause taken viaThrowable.getCause()
of the verified throwable
-
hasPrimaryCause
@SafeVarargs public static <T extends Throwable> ThrowableIsCausedByMatcher hasPrimaryCause(Class<T> expectedClass, org.hamcrest.Matcher<? super String>... messageMatchers)
Defines expected class and message criteria ofThrowable
which is taken viaThrowable.getCause()
of the verified throwable- Type Parameters:
T
- is a type of throwable-cause- Parameters:
expectedClass
- is expected class of throwable-causemessageMatchers
- criteria to check message of a throwable- Returns:
- an instance of
ThrowableIsCausedByMatcher
that checks only first cause taken viaThrowable.getCause()
of the verified throwable
-
hasRootCause
@SafeVarargs public static ThrowableIsCausedByMatcher hasRootCause(org.hamcrest.Matcher<? super Throwable>... matchers)
Defines criteria to find any suitable throwable-cause of the verified throwable- Parameters:
matchers
- criteria to check throwable- Returns:
- an instance of
ThrowableIsCausedByMatcher
that checks all throwable-causes of the verified throwable until it finds ane that matches all defined criteria
-
hasRootCause
public static <T extends Throwable> ThrowableIsCausedByMatcher hasRootCause(Class<T> expectedClass)
Defines expected class to find any suitable throwable-cause of the verified throwable- Type Parameters:
T
- is a type of throwable-cause- Parameters:
expectedClass
- is expected class of throwable-cause- Returns:
- an instance of
ThrowableIsCausedByMatcher
that checks all throwable-causes of the verified throwable until it finds ane that matches all defined criteria
-
hasRootCause
public static <T extends Throwable> ThrowableIsCausedByMatcher hasRootCause(Class<T> expectedClass, String message)
Defines expected class and message to find any suitable throwable-cause of the verified throwable- Type Parameters:
T
- is a type of throwable-cause- Parameters:
expectedClass
- is expected class of throwable-causemessage
- is expected message of throwable-cause- Returns:
- an instance of
ThrowableIsCausedByMatcher
that checks all throwable-causes of the verified throwable until it finds ane that matches all defined criteria
-
hasRootCause
@SafeVarargs public static <T extends Throwable> ThrowableIsCausedByMatcher hasRootCause(Class<T> expectedClass, org.hamcrest.Matcher<? super String>... messageMatchers)
Defines expected class and message criteria to find any suitable throwable-cause of the verified throwable- Type Parameters:
T
- is a type of throwable-cause- Parameters:
expectedClass
- is expected class of throwable-causemessageMatchers
- criteria to check message of a throwable- Returns:
- an instance of
ThrowableIsCausedByMatcher
that checks all throwable-causes of the verified throwable until it finds ane that matches all defined criteria
-
featureMatches
protected boolean featureMatches(Throwable toMatch)
- Specified by:
featureMatches
in classNeptuneFeatureMatcher<Throwable>
-
-