The XUnit unit test framework supplies the following built-in assertions:
- true - representation must be java.lang.Boolean.TRUE
- false - representation must be java.lang.Boolean.FALSE
- null - representation must be null
- notNull - representation must not be null
- stringEquals - representation must be a java.lang.String and must have the specified value.
- regex - representation must be a java.lang.String have a .toString() method and must match the regular expression pattern specified as the value.
- int - representation must be a java.lang.Integer or java.lang.Long or java.lang.BigIntegerand must have the specified value.
- float - representation must be a java.lang.Float or java.lang.Double and must have the specified value.
- maxTime - request must not exceed this time
- minTime - request must exceed this time
- class - representation must be instanceof the class
- mimetype - response must have this mimetype
- expired - response must be expired
- notExpired - response must not be expired
- minTotalCost - response total cost, including all sub-request costs, must exceed this cost.
- maxTotalCost - response total cost, including all sub-request costs, must not exceed this cost.
- minLocalCost - response total cost, excluding any sub-request costs, must exceed this cost.
- maxLocalCost - response total cost, excluding any sub-request costs, must not exceed this cost.
- scope - response must have this scope depth
- exception - response must be an exception and has this id.
- exceptionMessage - response must be an exception and has this message.
- headerExists - tests that response has a named header. A single item will is taken to be the header name to test for existence. If the value is two-valued comma separated list then the first item is the header name and second item is the expected representation class of the header.
For example, the following assert validates that
a test request response representation is an instance of
and the request took no longer than 20 milliseconds
and the representation is not expired: