Package org.apache.beam.sdk.testing
Class JsonMatcher<T>
java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeMatcher<T>
org.apache.beam.sdk.testing.JsonMatcher<T>
- All Implemented Interfaces:
Matcher<T>,SelfDescribing
Matcher to compare a string or byte[] representing a JSON Object, independent of field order.
assertThat("{\"name\": \"person\", \"height\": 80}",
jsonStringLike("{\"height\": 80, \"name\": \"person\"}"));
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddescribeMismatchSafely(T item, Description mismatchDescription) voiddescribeTo(Description description) static Matcher<byte[]> jsonBytesLike(String json) static Matcher<byte[]> jsonBytesLike(Map<String, Object> fields) jsonStringLike(String json) jsonStringLike(Map<String, Object> fields) protected booleanmatchesSafely(T actual) Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matchesMethods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString
-
Constructor Details
-
JsonMatcher
-
-
Method Details
-
parse
- Throws:
IOException
-
jsonBytesLike
- Throws:
IOException
-
jsonBytesLike
- Throws:
IOException
-
jsonStringLike
- Throws:
IOException
-
jsonStringLike
- Throws:
IOException
-
matchesSafely
- Specified by:
matchesSafelyin classTypeSafeMatcher<T>
-
describeTo
-
describeMismatchSafely
- Overrides:
describeMismatchSafelyin classTypeSafeMatcher<T>
-