Associating and using metadata with API stubs#
It is possible to attach arbitrary metadata to stub mappings, which can be later used to search or deletion, or simply retrieval.
Adding metadata to stubs#
Data under the metadata
key is a JSON object (represented in Java by a Map<String, ?>
). It can be added to a stub mapping on creation.
Search for stubs by metadata#
Stubs can be found by matching against their metadata using the same matching strategies as when matching HTTP requests.
The most useful matcher for this is matchesJsonPath
:
Remove stubs by metadata#
Similarly, stubs with matching metadata can be removed: