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 IOException
comparison using default delta- Throws:
IOException
- See Also:
DEFAULT_DELTA
,match(String,String,double)
-
match
public static String match(String path, String input, String expected) throws IOException
comparison using default delta- Throws:
IOException
- See Also:
DEFAULT_DELTA
,match(String,String,String,double)
-
matchObj
public static String matchObj(String path, Object input, Object expected) throws IOException
comparison using default delta- Throws:
IOException
- See Also:
DEFAULT_DELTA
,matchObj(String,Object,Object,double)
-
match
public static String match(String input, String pathAndExpected, double delta) throws IOException
- Parameters:
input
- JSON Structure to parse and test againstpathAndExpected
- JSON path expression + '==' + expected valuedelta
- tolerance allowed in comparing float/double values- Throws:
IOException
-
matchObj
public static String matchObj(Object input, String pathAndExpected, double delta) throws IOException
- Parameters:
input
- Object structure to parse and test againstpathAndExpected
- JSON path expression + '==' + expected valuedelta
- tolerance allowed in comparing float/double values- Throws:
IOException
-
match
public static String match(String path, String input, String expected, double delta) throws IOException
- Parameters:
path
- JSON path expressioninput
- JSON Structure to parse and test againstexpected
- expected value of pathdelta
- tolerance allowed in comparing float/double values- Throws:
IOException
-
matchObj
public static String matchObj(String path, Object input, Object expected, double delta)
- Parameters:
path
- JSON path expressioninput
- JSON Structureexpected
- expected JSON Objectdelta
- tolerance allowed in comparing float/double values- Returns:
- the error message from the match, or null if match was good
-
-