Package com.shaft.tools.io
Class JSONFileManager
java.lang.Object
com.shaft.tools.io.JSONFileManager
- Direct Known Subclasses:
SHAFT.TestData.JSON
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionJSONFileManager
(String jsonFilePath) Creates a new instance of the test data json reader using the target json file path -
Method Summary
Modifier and TypeMethodDescriptiongetTestData
(String jsonPath) Reads the string value at the desired jsonpath within the target test data filegetTestDataAsJson
(String jsonPath) Reads the json object value at the desired jsonpath within the target test data file to map it to java objectList
<?> getTestDataAsList
(String jsonPath) Reads the list value at the desired jsonpath within the target test data fileMap
<?, ?> getTestDataAsMap
(String jsonPath) Reads the map value at the desired jsonpath within the target test data file
-
Constructor Details
-
JSONFileManager
Creates a new instance of the test data json reader using the target json file path- Parameters:
jsonFilePath
- target test data json file path
-
-
Method Details
-
getTestData
Reads the string value at the desired jsonpath within the target test data file- Parameters:
jsonPath
- the desired jsonpath that points to the needed test data, it can be written manually or generated using helper tools such as https://jsonpathfinder.com/- Returns:
- the string value of the desired test data
-
getTestDataAsJson
Reads the json object value at the desired jsonpath within the target test data file to map it to java object- Parameters:
jsonPath
- the desired jsonpath that points to the needed test data, it can be written manually or generated using helper tools such as https://jsonpathfinder.com/- Returns:
- the json value of the desired test data as Object
-
getTestDataAsList
Reads the list value at the desired jsonpath within the target test data file- Parameters:
jsonPath
- the desired jsonpath that points to the needed test data, it can be written manually or generated using helper tools such as https://jsonpathfinder.com/- Returns:
- the list value of the desired test data
-
getTestDataAsMap
Reads the map value at the desired jsonpath within the target test data file- Parameters:
jsonPath
- the desired jsonpath that points to the needed test data, it can be written manually or generated using helper tools such as https://jsonpathfinder.com/- Returns:
- the map value of the desired test data
-