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
variablesas the whole environment.const
Properties
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