TestEnvironment class final

Sets the environment variables that the test class's application sees, in place of the machine's.

Without it the environment is empty, so a test never depends on the variables of the machine it runs on. Use it to test settings that normally come from variables, such as SHOP_MAX_BASKET_SIZE, which binds to shop.max-basket-size. Spring has no such annotation: its tests see the real environment.

// The limit comes from a variable, as on the production server.
@SpringBootTest()
@TestEnvironment({'SHOP_MAX_BASKET_SIZE': '25'})
class BasketLimitTest { ... }

Constructors

TestEnvironment(Map<String, String> variables)
Uses variables as the whole environment.
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
variables → Map<String, String>
The variables by name, as strings, as the operating system gives them.
final

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