Class Assertion

java.lang.Object
org.elasticsearch.test.rest.yaml.section.Assertion
All Implemented Interfaces:
ExecutableSection
Direct Known Subclasses:
ContainsAssertion, GreaterThanAssertion, GreaterThanEqualToAssertion, IsFalseAssertion, IsTrueAssertion, LengthAssertion, LessThanAssertion, LessThanOrEqualToAssertion, MatchAssertion

public abstract class Assertion
extends java.lang.Object
implements ExecutableSection
Base class for executable sections that hold assertions
  • Field Summary

    Fields inherited from interface org.elasticsearch.test.rest.yaml.section.ExecutableSection

    DEFAULT_EXECUTABLE_CONTEXTS, XCONTENT_REGISTRY
  • Constructor Summary

    Constructors
    Modifier Constructor Description
    protected Assertion​(org.elasticsearch.common.xcontent.XContentLocation location, java.lang.String field, java.lang.Object expectedValue)  
  • Method Summary

    Modifier and Type Method Description
    protected abstract void doAssert​(java.lang.Object actualValue, java.lang.Object expectedValue)
    Executes the assertion comparing the actual value (parsed from the response) with the expected one
    void execute​(ClientYamlTestExecutionContext executionContext)
    Executes the section passing in the execution context
    protected java.lang.Object getActualValue​(ClientYamlTestExecutionContext executionContext)  
    java.lang.Object getExpectedValue()  
    java.lang.String getField()  
    org.elasticsearch.common.xcontent.XContentLocation getLocation()
    Get the location in the test that this was defined.
    protected java.lang.Object resolveExpectedValue​(ClientYamlTestExecutionContext executionContext)  
    protected java.lang.Class<?> safeClass​(java.lang.Object o)
    a utility to get the class of an object, protecting for null (i.e., returning null if the input is null)

    Methods inherited from class java.lang.Object

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

    • Assertion

      protected Assertion​(org.elasticsearch.common.xcontent.XContentLocation location, java.lang.String field, java.lang.Object expectedValue)
  • Method Details

    • getField

      public final java.lang.String getField()
    • getExpectedValue

      public final java.lang.Object getExpectedValue()
    • resolveExpectedValue

      protected final java.lang.Object resolveExpectedValue​(ClientYamlTestExecutionContext executionContext) throws java.io.IOException
      Throws:
      java.io.IOException
    • getActualValue

      protected final java.lang.Object getActualValue​(ClientYamlTestExecutionContext executionContext) throws java.io.IOException
      Throws:
      java.io.IOException
    • getLocation

      public org.elasticsearch.common.xcontent.XContentLocation getLocation()
      Description copied from interface: ExecutableSection
      Get the location in the test that this was defined.
      Specified by:
      getLocation in interface ExecutableSection
    • execute

      public final void execute​(ClientYamlTestExecutionContext executionContext) throws java.io.IOException
      Description copied from interface: ExecutableSection
      Executes the section passing in the execution context
      Specified by:
      execute in interface ExecutableSection
      Throws:
      java.io.IOException
    • doAssert

      protected abstract void doAssert​(java.lang.Object actualValue, java.lang.Object expectedValue)
      Executes the assertion comparing the actual value (parsed from the response) with the expected one
    • safeClass

      protected java.lang.Class<?> safeClass​(java.lang.Object o)
      a utility to get the class of an object, protecting for null (i.e., returning null if the input is null)