public interface ErrorCriterion
Spine errors
must match.
Optionally can contain an the criterion description, useful for display by test assertions.
These criteria are consumed by acks verifier
ackedWithError method
.
Modifier and Type | Method and Description |
---|---|
default java.lang.String |
description()
Returns a message describing the criterion.
|
boolean |
matches(T target)
Checks if target matches the criterion.
|
static ErrorAttributeCriterion |
withAttribute(java.lang.String name)
A static factory method for creating an
error attribute
criterion . |
static ErrorCriterion |
withCode(int code)
Verifies that the
errors code matches the provided one. |
static ErrorCriterion |
withMessage(java.lang.String message)
Verifies that the
errors message matches the provided one. |
static ErrorCriterion |
withoutAttribute(java.lang.String name)
Verifies that the error does not contain
an attribute
with a provided name. |
static ErrorCriterion |
withType(java.lang.String type)
Verifies that the
errors type matches the provided one. |
default java.lang.String description()
static ErrorCriterion withType(java.lang.String type)
errors type
matches the provided one.type
- a type that is to be matched in errorErrorCriterion error criterion
instancestatic ErrorCriterion withCode(int code)
errors code
matches the provided one.code
- a code that is to be matched in errorstatic ErrorCriterion withMessage(java.lang.String message)
errors message
matches the provided one.message
- a message that is to be matched in errorstatic ErrorAttributeCriterion withAttribute(java.lang.String name)
error attribute
criterion
.
An error attribute verifier checks that the error contains an
attribute
with a provided name.
name
- name of an attribute which looked for by this criterionerror attribute criterion
instancestatic ErrorCriterion withoutAttribute(java.lang.String name)
an attribute
with a provided name.name
- a name of an attribute that must be absent in errorboolean matches(T target)
target
- an object ot checktrue
if target matches the criterion, false
otherwise