org.specrunner.plugins.core.logical
Class PluginEquals

java.lang.Object
  extended by org.specrunner.parameters.core.ParameterHolder
      extended by org.specrunner.plugins.core.AbstractPlugin
          extended by org.specrunner.plugins.core.AbstractPluginNamed
              extended by org.specrunner.plugins.core.AbstractPluginScoped
                  extended by org.specrunner.plugins.core.AbstractPluginValue
                      extended by org.specrunner.plugins.core.AbstractPluginDual
                          extended by org.specrunner.plugins.core.logical.PluginEquals
All Implemented Interfaces:
IParameterHolder, IActionType, IParalelPlugin, IPlugin, ISleepPlugin, ITestPlugin, ITimedPlugin, IWaitPlugin
Direct Known Subclasses:
PluginNotEquals

public class PluginEquals
extends AbstractPluginDual

Compare elements. Use class 'eq', there are two approaches:

In both comparisons a specific comparator can be set using attribute comparator.

Author:
Thiago Santos

Field Summary
protected  Throwable error
          Error object after failure.
 
Fields inherited from class org.specrunner.plugins.core.AbstractPlugin
FEATURE_CONDITION, FEATURE_NORMALIZED, FEATURE_SLEEP, FEATURE_THREADSAFE, FEATURE_TIMEOUT, FEATURE_WAIT
 
Constructor Summary
PluginEquals()
           
 
Method Summary
 ActionType getActionType()
          Get the plugin type.
protected  Throwable getError()
          Gets the error, if the operation returns false.
protected  boolean operation(Object obj, IContext context)
          Stand for the testing operation.
 void setValue(Object value)
          Sets the value.
protected  boolean verify(IContext context, IComparator comparator, Object expected, Object received)
          Verify the condition.
 
Methods inherited from class org.specrunner.plugins.core.AbstractPluginDual
doEnd, doStart, getObjectValue, getOnstart, perform, setOnstart
 
Methods inherited from class org.specrunner.plugins.core.AbstractPluginValue
getValue, getValue, isEval, setEval
 
Methods inherited from class org.specrunner.plugins.core.AbstractPluginScoped
getScope, saveGlobal, saveLocal, saveStrict, setScope
 
Methods inherited from class org.specrunner.plugins.core.AbstractPluginNamed
getName, setName
 
Methods inherited from class org.specrunner.plugins.core.AbstractPlugin
copy, getCondition, getConditionModel, getNormalized, getNormalized, getParent, getSleep, getSleepModel, getThreadsafe, getTimeout, getTimeoutModel, getWait, getWaitModel, initialize, setCondition, setConditionModel, setNormalized, setParent, setSleep, setSleepModel, setThreadsafe, setTimeout, setTimeoutModel, setWait, setWaitModel, toString
 
Methods inherited from class org.specrunner.parameters.core.ParameterHolder
getParameters, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.specrunner.parameters.IParameterHolder
getParameters, setParameters
 

Field Detail

error

protected Throwable error
Error object after failure.

Constructor Detail

PluginEquals

public PluginEquals()
Method Detail

getActionType

public ActionType getActionType()
Description copied from interface: IActionType
Get the plugin type.

Returns:
The type.

setValue

public void setValue(Object value)
Description copied from class: AbstractPluginValue
Sets the value.

Overrides:
setValue in class AbstractPluginValue
Parameters:
value - A new value.

operation

protected boolean operation(Object obj,
                            IContext context)
                     throws PluginException
Description copied from class: AbstractPluginDual
Stand for the testing operation.

Specified by:
operation in class AbstractPluginDual
Parameters:
obj - The value to be used.
context - The context.
Returns:
true status must be OK, false otherwise, in which case error should be set.
Throws:
PluginException - On operation errors.

verify

protected boolean verify(IContext context,
                         IComparator comparator,
                         Object expected,
                         Object received)
                  throws SpecRunnerException
Verify the condition.

Parameters:
context - The context.
comparator - Comparator.
expected - The reference value.
received - The received value.
Returns:
true, if equals, false, otherwise.
Throws:
SpecRunnerException - On condition errors.

getError

protected Throwable getError()
Description copied from class: AbstractPluginDual
Gets the error, if the operation returns false.

Specified by:
getError in class AbstractPluginDual
Returns:
The failure.


Copyright © 2014. All rights reserved.