public class FlatInteraction extends Object
If data is stored in this interaction, the values from maps and lists are stored recursively too. The following examples illustrate this: - remember("key", "value") = ["key", "value"] - remember("key.key", "value") = ["key.key", "value"] - remember("key", ["key": "value"]) = ["key": ["key": "value"], "key.key", "value"] - remember("key", [["key": "value"]] = ["key": ["value"], "key[0].key", "value"] Further examples can be found in @see FlatInteractionSpec.
The advantage of this approach is the safe and fast availability of the test data, but be careful when saving large and deep maps.
Copyright (c) 2019 Daniel Keiss, Deutsche Telekom AG This file is distributed under the conditions of the Apache License, Version 2.0. For details see the file license on the toplevel.
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Object> |
context |
static String |
LIST_ITEM_FORMAT |
static String |
OBJECT_KEY_SEPARATOR |
| Constructor and Description |
|---|
FlatInteraction() |
| Modifier and Type | Method and Description |
|---|---|
default void |
clear(Enum key) |
default void |
clear(String key) |
Map<String,Object> |
getContext() |
void |
logAllPossibleKeysWithType()
Be careful with this method.
|
void |
logAllPossibleKeysWithValue()
Be careful with this method.
|
default <S> S |
recall(Enum key)
Get some data in the interaction context.
|
<S> S |
recall(String key)
Get some data in the interaction context.
|
<S> S |
recallByHierarchy(String key)
Get the value from a complex type by reflection, even in hierarchical objects.
|
default <S> List<S> |
recallList(Enum key) |
default <S> List<S> |
recallList(String key) |
default <S> List<S> |
recallListOrCreateNew(Enum key) |
default <S> List<S> |
recallListOrCreateNew(String key) |
default <S> Map<String,S> |
recallMap(Enum key) |
default <S> Map<String,S> |
recallMap(String key) |
default <S> Map<String,S> |
recallMapOrCreateNew(Enum key) |
default <S> Map<String,S> |
recallMapOrCreateNew(String key) |
default <S> S |
recallNotNull(Enum key) |
default <S> S |
recallNotNull(String key) |
default <S> S |
recallObject(Enum objectKey,
String attributeKey) |
default <S> S |
recallObject(String objectKey,
String attributeKey) |
default <S> S |
recallObjectNotNull(Enum objectKey,
String attributeKey) |
default <S> S |
recallObjectNotNull(String objectKey,
String attributeKey) |
default void |
remember(Enum key,
Object value)
Store some data in the interaction context for later use.
|
void |
remember(String key,
Object value)
Store some test data in the interaction context for later use.
|
default void |
rememberObject(Enum entityKey,
Map<String,Object> object) |
default void |
rememberObject(Enum entityKey,
String objectKey,
Object value) |
default void |
rememberObject(String entityKey,
Map<String,Object> object) |
default void |
rememberObject(String entityKey,
String objectKey,
Object value) |
default <S> void |
rememberToList(Enum key,
S value) |
default <S> void |
rememberToList(String key,
S value) |
void |
startInteraction() |
void |
stopInteraction() |
public static String LIST_ITEM_FORMAT
public static final String OBJECT_KEY_SEPARATOR
public void startInteraction()
public void stopInteraction()
public void remember(String key, Object value)
public <S> S recall(String key)
public <S> S recallByHierarchy(String key)
public void logAllPossibleKeysWithValue()
public void logAllPossibleKeysWithType()
public void remember(Enum key, Object value)
public <S> S recall(Enum key)
public <S> S recallNotNull(String key)
public <S> S recallNotNull(Enum key)
public <S> void rememberToList(String key, S value)
public <S> void rememberToList(Enum key, S value)
public void clear(String key)
public void clear(Enum key)
Copyright © 2017–2020. All rights reserved.