NegativeTestCase<INPUT extends Object?, OUTPUT extends Object?> class Null safety

A TestCase class that can be used to match exceptions. It uses the throwsA matcher.

Example:

void main() {
  NegativeTestCase(
    when: 'Zero height value',
    input: 0,
    exception: HeightNotValidException,
    action: (double input) => Height(input).toStringInMetre(),
  ).execute();
}
Inheritance

Constructors

NegativeTestCase({required String when, required INPUT input, required Type exception, ParameterizedCallback<INPUT, OUTPUT>? action, String? testOn, Timeout? timeout, dynamic skip, dynamic tags, Map<String, dynamic>? onPlatform, int? retry})
action is optional. Do not provide action if the TestCase is executed in a TestGroup. then is defaulted.

Properties

action ParameterizedCallback<INPUT, OUTPUT>?
Provided only if the TestCase is executed without a TestGroup. If TestGroup is provided, the common action is run by just varying the input.
final, inherited
description String
You can extend this class and override this field. [...]
read-only, inherited
descriptionDelimiter String
descriptionDelimiter is defaulted to this class. You can extend this class and override this field.
final, inherited
exception Type
Exception Type can be provided instead of a custom matcher. Uses ParameterizedTypeMatcher instead of TypeMatcher/isA. Generated matcher will be 'throwsA(ParameterizedTypeMatcher(exception))' [...]
final
hashCode int
The hash code for this object. [...]
read-only, inherited
input → INPUT
Input value for the test case. The type is provided as a generic.
final, inherited
matcher → dynamic
Custom output matcher for the test case. Sent as such to the test function.
final, inherited
onPlatform Map<String, dynamic>?
Direct forward to test function
final, inherited
retry int?
Direct forward to test function
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
skip → dynamic
Direct forward to test function
final, inherited
tags → dynamic
Direct forward to test function
final, inherited
testOn String?
Direct forward to test function
final, inherited
then String
'then' part of the description. [...]
final, inherited
timeout Timeout?
Direct forward to test function
final, inherited
when String
'when' part of the description. [...]
final, inherited

Methods

copyWith(ParameterizedCallback<INPUT, OUTPUT> action) NegativeTestCase<INPUT, OUTPUT>
copyWith is used internally by the TestGroup.
override
execute() → void
execute is overridden to wrap action in a function so that exception can be caught and matched.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited