Class JSONMatcher<T>

java.lang.Object
org.hamcrest.BaseMatcher<T>
de.hybris.platform.cmsfacades.util.JSONMatcher<T>
Type Parameters:
T - the type parameter of the matcher
All Implemented Interfaces:
org.hamcrest.Matcher<T>, org.hamcrest.SelfDescribing

public class JSONMatcher<T> extends org.hamcrest.BaseMatcher<T>
Custom Matcher to assert that the serialization of an object matches the one stored in file.
  • Constructor Summary

    Constructors
    Constructor
    Description
    JSONMatcher(String pathToExpected)
    Will return true if the JSON serialization of the actual is equal to the trimmed serialization of the JSON contained in the provided path
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    describeTo(org.hamcrest.Description description)
     
    boolean
    matches(Object actual)
     

    Methods inherited from class org.hamcrest.BaseMatcher

    _dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, isNotNull, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • JSONMatcher

      public JSONMatcher(String pathToExpected) throws IOException
      Will return true if the JSON serialization of the actual is equal to the trimmed serialization of the JSON contained in the provided path
      Parameters:
      pathToExpected - path in the classpath to the file containing the expected JSON string, it can contain a beautified JSON
      Throws:
      IOException
  • Method Details

    • matches

      public boolean matches(Object actual)
    • describeTo

      public void describeTo(org.hamcrest.Description description)