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 void
describeMismatchSafely
(T item, Description mismatchDescription) void
describeTo
(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 boolean
matchesSafely
(T actual) Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
Methods 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:
matchesSafely
in classTypeSafeMatcher<T>
-
describeTo
-
describeMismatchSafely
- Overrides:
describeMismatchSafely
in classTypeSafeMatcher<T>
-