org.hansel.probes
Class BranchProbe

java.lang.Object
  extended by org.hansel.Probe
      extended by org.hansel.probes.BranchProbe
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
ACmpBranchProbe, BinaryBranchProbe, CompBranchProbe, NullCmpBranchProbe, UnaryBranchProbe

public abstract class BranchProbe
extends Probe

A probe for a conditional branch. For decision coverage both possible conditions for the branch have to be encountered.

Author:
Niklas Mehner.

Field Summary
 
Fields inherited from class org.hansel.Probe
HIT_CLASS
 
Constructor Summary
BranchProbe(ProbeData pd, HanselValue value)
           
 
Method Summary
protected  void cover(boolean condition)
           
 boolean coverageFailure()
           
 boolean displayFailure()
          Return wether this probe failed to be covered.
 java.lang.String getFailureMessage()
          Return the filure message for this probe.
 
Methods inherited from class org.hansel.Probe
addResult, countTestCases, equals, getDescription, getID, getName, getProbeData, hashCode, insertProbeCode, run, run, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BranchProbe

public BranchProbe(ProbeData pd,
                   HanselValue value)
Method Detail

getFailureMessage

public java.lang.String getFailureMessage()
Return the filure message for this probe.

Specified by:
getFailureMessage in class Probe
Returns:
Failure message.

cover

protected void cover(boolean condition)

displayFailure

public boolean displayFailure()
Return wether this probe failed to be covered. A probe for a conditional branch fails, if the branch is only taken, or only omitted. If both cases are encountered, the probe is fully covered. If the probe is not executed at all, this method still returns false, because in that case, another probe has to fail (otherwise this probe had been reached). Because the other failure is more important, the result of this probe is left out in this case.

Specified by:
displayFailure in class Probe
Returns:
true If covering this probe failed.

coverageFailure

public boolean coverageFailure()
Specified by:
coverageFailure in class Probe