Package org.apache.solr
Class JSONTestUtil
- java.lang.Object
-
- org.apache.solr.JSONTestUtil
-
public class JSONTestUtil extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_DELTA
Default delta used in numeric equality comparisons for floats and doubles.static boolean
failRepeatedKeys
-
Constructor Summary
Constructors Constructor Description JSONTestUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
match(String input, String pathAndExpected)
comparison using default deltastatic String
match(String input, String pathAndExpected, double delta)
static String
match(String path, String input, String expected)
comparison using default deltastatic String
match(String path, String input, String expected, double delta)
static String
matchObj(Object input, String pathAndExpected, double delta)
static String
matchObj(String path, Object input, Object expected)
comparison using default deltastatic String
matchObj(String path, Object input, Object expected, double delta)
-
-
-
Field Detail
-
DEFAULT_DELTA
public static final double DEFAULT_DELTA
Default delta used in numeric equality comparisons for floats and doubles.- See Also:
- Constant Field Values
-
failRepeatedKeys
public static boolean failRepeatedKeys
-
-
Method Detail
-
match
public static String match(String input, String pathAndExpected) throws Exception
comparison using default delta- Throws:
Exception
- See Also:
DEFAULT_DELTA
,match(String,String,double)
-
match
public static String match(String path, String input, String expected) throws Exception
comparison using default delta- Throws:
Exception
- See Also:
DEFAULT_DELTA
,match(String,String,String,double)
-
matchObj
public static String matchObj(String path, Object input, Object expected) throws Exception
comparison using default delta- Throws:
Exception
- See Also:
DEFAULT_DELTA
,matchObj(String,Object,Object,double)
-
match
public static String match(String input, String pathAndExpected, double delta) throws Exception
- Parameters:
input
- JSON Structure to parse and test againstpathAndExpected
- JSON path expression + '==' + expected valuedelta
- tollerance allowed in comparing float/double values- Throws:
Exception
-
matchObj
public static String matchObj(Object input, String pathAndExpected, double delta) throws Exception
- Parameters:
input
- Object structure to parse and test againstpathAndExpected
- JSON path expression + '==' + expected valuedelta
- tollerance allowed in comparing float/double values- Throws:
Exception
-
match
public static String match(String path, String input, String expected, double delta) throws Exception
- Parameters:
path
- JSON path expressioninput
- JSON Structure to parse and test againstexpected
- expected value of pathdelta
- tollerance allowed in comparing float/double values- Throws:
Exception
-
-