WireMockMatchers.java

  1. package fr.sii.ogham.testing.assertion.wiremock;

  2. import org.w3c.dom.Document;

  3. import com.github.tomakehurst.wiremock.client.WireMock;

  4. import fr.sii.ogham.testing.assertion.util.HtmlUtils;

  5. /**
  6.  * Additional matchers for {@link WireMock}.
  7.  *
  8.  * @author AurĂ©lien Baudet
  9.  *
  10.  */
  11. public final class WireMockMatchers {

  12.     /**
  13.      * Check if the HTML is similar to the expected. The HTML strings are parsed
  14.      * into {@link Document}s. Two documents are considered to be "similar" if
  15.      * they contain the same elements and attributes regardless of order.
  16.      *
  17.      * <p>
  18.      * See {@link HtmlUtils} for more information about "similar" HTML.
  19.      *
  20.      * <p>
  21.      * NOTE: {@link WireMock#equalToXml(String)} does an identical check.
  22.      *
  23.      * @param expected
  24.      *            the expected HTML
  25.      * @return the WireMock matcher
  26.      */
  27.     public static SimilarHtmlPattern similarHtml(String expected) {
  28.         return new SimilarHtmlPattern(expected);
  29.     }

  30.     private WireMockMatchers() {
  31.         super();
  32.     }
  33. }