java.lang.Object
uk.org.webcompere.modelassert.json.dsl.nodespecific.tree.WhereDsl<A>
Type Parameters:
A - the type of assertion this belongs to
All Implemented Interfaces:
IsEqualToDsl<A>

public class WhereDsl<A> extends Object implements IsEqualToDsl<A>
The DSL for the Where Context
  • Constructor Details

    • WhereDsl

      public WhereDsl(Satisfies<A> coreAssertion)
      Construct with the assertion to return to
      Parameters:
      coreAssertion - the core assertion, as expressed by its Satisfies entry point
  • Method Details

    • keysInAnyOrder

      public WhereDsl<A> keysInAnyOrder()
      Relax the key ordering constraint for everywhere
      Returns:
      this for fluent calling
    • objectContains

      public WhereDsl<A> objectContains()
      Allow missing keys in objects
      Returns:
      this for fluent calling
    • arrayInAnyOrder

      public WhereDsl<A> arrayInAnyOrder()
      Relax the ordering requirement for an array, everywhere
      Returns:
      this for fluent calling
    • arrayContains

      public WhereDsl<A> arrayContains()
      Allow arrays to just contain the other elements rather than match completely
      Returns:
      this for fluent calling
    • configuredBy

      public WhereDsl<A> configuredBy(UnaryOperator<WhereDsl<A>> configurer)
      Add common configuration to the where dsl
      Parameters:
      configurer - the configurer to use
      Returns:
      the WhereDsl for further customisation
    • path

      public PathDsl<A> path(Object pathStart, Object... pathRemainder)
      Enter the path context - specialising a rule for the given path. The path is a list of node ids or wildcards leading from the root element up to some part of the tree we're going to specialise. This is useful for mixing named fields or array indices with PathWildCards like PathWildCard.ANY or PathWildCard.ANY_SUBTREE, but can be long winded for when there's a fixed path, and doesn't allow for expressing a rule on root. There's also at(String) which will allow a root path - "/"
      Parameters:
      pathStart - the first String, PathWildCard or Pattern
      pathRemainder - the remaining String, PathWildCard or Patterns
      Returns:
      the PathDsl to complete specialising what to do at that path instead of the defaults
    • at

      public PathDsl<A> at(String jsonPointer)
      Provide a path using the JSON Pointer syntax - i.e. no wildcards or regular expressions used. Note: this allows for matching to the root object with a path of "/"
      Parameters:
      jsonPointer - the json pointer expression
      Returns:
      the PathDsl to complete specialising what to do at that path instead of the defaults
    • isEqualTo

      public A isEqualTo(TreeComparisonCondition condition)
      Description copied from interface: IsEqualToDsl
      Terminal statement - apply the final comparison condition to the assertion. Called internally.
      Specified by:
      isEqualTo in interface IsEqualToDsl<A>
      Parameters:
      condition - the condition
      Returns:
      the assertion for fluent comparison
    • isNotEqualTo

      public A isNotEqualTo(TreeComparisonCondition condition)
      Description copied from interface: IsEqualToDsl
      Terminal statement - apply the final comparison condition to the assertion. Called internally.
      Specified by:
      isNotEqualTo in interface IsEqualToDsl<A>
      Parameters:
      condition - the condition
      Returns:
      the assertion for fluent comparison