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(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 onevoid
execute(ClientYamlTestExecutionContext executionContext)
Executes the section passing in the execution contextprotected java.lang.Object
getActualValue(ClientYamlTestExecutionContext executionContext)
java.lang.Object
getExpectedValue()
java.lang.String
getField()
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)
-
-
-
Constructor Detail
-
Assertion
protected Assertion(XContentLocation location, java.lang.String field, java.lang.Object expectedValue)
-
-
Method Detail
-
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 XContentLocation getLocation()
Description copied from interface:ExecutableSection
Get the location in the test that this was defined.- Specified by:
getLocation
in interfaceExecutableSection
-
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 interfaceExecutableSection
- 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)
-
-