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 protectedAssertion(XContentLocation location, java.lang.String field, java.lang.Object expectedValue)
-
Method Summary
Modifier and Type Method Description protected abstract voiddoAssert(java.lang.Object actualValue, java.lang.Object expectedValue)Executes the assertion comparing the actual value (parsed from the response) with the expected onevoidexecute(ClientYamlTestExecutionContext executionContext)Executes the section passing in the execution contextprotected java.lang.ObjectgetActualValue(ClientYamlTestExecutionContext executionContext)java.lang.ObjectgetExpectedValue()java.lang.StringgetField()XContentLocationgetLocation()Get the location in the test that this was defined.protected java.lang.ObjectresolveExpectedValue(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:ExecutableSectionGet the location in the test that this was defined.- Specified by:
getLocationin interfaceExecutableSection
-
execute
public final void execute(ClientYamlTestExecutionContext executionContext) throws java.io.IOException
Description copied from interface:ExecutableSectionExecutes the section passing in the execution context- Specified by:
executein 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)
-
-