Class JSONFileManager

java.lang.Object
com.shaft.tools.io.JSONFileManager
Direct Known Subclasses:
SHAFT.TestData.JSON

public class JSONFileManager extends Object
  • Constructor Details

    • JSONFileManager

      public JSONFileManager(String jsonFilePath)
      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

      public String getTestData(String jsonPath)
      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

      public Object getTestDataAsJson(String jsonPath)
      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

      public List<?> getTestDataAsList(String jsonPath)
      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

      public Map<?,?> getTestDataAsMap(String jsonPath)
      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