Class JsonDocumentValidator
- java.lang.Object
-
- org.uitnet.testing.smartfwk.core.validator.json.JsonDocumentValidator
-
public class JsonDocumentValidator extends Object
- Author:
- Madhav Krishna
-
-
Field Summary
Fields Modifier and Type Field Description protected JsonDocumentReaderjsonDocReader
-
Constructor Summary
Constructors Constructor Description JsonDocumentValidator(File jsonFilePath, boolean updateSystemVariablesValue)JsonDocumentValidator(String jsonAsString, boolean updateSystemVariablesValue)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.jayway.jsonpath.DocumentContextgetDocumentContext()static voidmain(String[] args)com.jayway.jsonpath.DocumentContextprepareDocumentContext(Object obj)<T> TreadSingleValue(String jsonPath)<T> TreadValueAsObject(String yamlPath, Class<T> clazz)<T> List<T>readValuesAsList(String jsonPath)<T> Set<T>readValuesAsSet(String jsonPath)voidvalidateAtleastNRecordsPresent(String elementName, String jsonPath, int atleastN)<T> voidvalidateExactMatchForValues(String elementName, String jsonPath, T[] values)voidvalidateExpectedNRecordsPresent(String elementName, String jsonPath, int expectedN)voidvalidatePathPresent(String elementName, String jsonPath)<T> voidvalidateSingleValueMatch(String elementName, String jsonPath, Class<T> valueClazz, T value)<T> voidvalidateValuesPresent(String elementName, String jsonPath, T[] values)
-
-
-
Field Detail
-
jsonDocReader
protected JsonDocumentReader jsonDocReader
-
-
Method Detail
-
prepareDocumentContext
public com.jayway.jsonpath.DocumentContext prepareDocumentContext(Object obj)
-
getDocumentContext
public com.jayway.jsonpath.DocumentContext getDocumentContext()
-
readSingleValue
public <T> T readSingleValue(String jsonPath)
-
validateExpectedNRecordsPresent
public void validateExpectedNRecordsPresent(String elementName, String jsonPath, int expectedN)
-
validateAtleastNRecordsPresent
public void validateAtleastNRecordsPresent(String elementName, String jsonPath, int atleastN)
-
validateValuesPresent
public <T> void validateValuesPresent(String elementName, String jsonPath, T[] values)
-
validateExactMatchForValues
public <T> void validateExactMatchForValues(String elementName, String jsonPath, T[] values)
-
validateSingleValueMatch
public <T> void validateSingleValueMatch(String elementName, String jsonPath, Class<T> valueClazz, T value)
-
main
public static void main(String[] args)
-
-