Package org.mockserver.imports
Class PostmanCollectionImporter
java.lang.Object
org.mockserver.imports.PostmanCollectionImporter
Imports expectations from Postman Collection v2.x (v2.0 and v2.1) JSON files.
Walks the item[] array recursively (folders contain nested item[]).
For each request that has saved example responses (response[]), one expectation
is created per example. Requests without saved examples are skipped with a logged count.
Handles Postman url being either a plain string or an object with
raw, path[], and query[].
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionimportExpectations(String collectionJson) Parses a Postman Collection v2.x JSON string and returns one expectation per saved example response.
-
Constructor Details
-
PostmanCollectionImporter
public PostmanCollectionImporter()
-
-
Method Details
-
importExpectations
Parses a Postman Collection v2.x JSON string and returns one expectation per saved example response.- Parameters:
collectionJson- the Postman collection as a JSON string- Returns:
- the generated expectations (may be empty if no examples are present)
- Throws:
IllegalArgumentException- if the JSON is null, blank, or not a valid Postman collection
-