CapturedOutput class final

Marks a late CapturedLogs field that holds what was logged through SpringLog during the current test.

Use it to check that code logs a warning or an error. The field is emptied before every test. In tests written as functions, call captureLogs() instead.

@CapturedOutput()
late CapturedLogs logs;

@Test()
void payingIsLogged() {
  checkout.pay(3);
  expect(logs.messages, contains('paid 3.0'));
}

Spring (Java): Spring Boot's OutputCaptureExtension with a CapturedOutput parameter. Here only SpringLog records are captured, not everything the process prints.

Constructors

CapturedOutput()
Marks the field.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited