01: package org.hansel;
02:
03: import org.hansel.probes.ProbeFilter;
04:
05: public class AssertionCoverageDecorator extends CoverageDecorator {
06:
07: public AssertionCoverageDecorator(Class[] classesCovered) {
08: super (classesCovered, new AssertionProbeFilter());
09: }
10:
11: public AssertionCoverageDecorator(Class testClass,
12: Class[] classesCovered) {
13: super (testClass, classesCovered, new AssertionProbeFilter());
14: }
15:
16: private static class AssertionProbeFilter implements ProbeFilter {
17: public boolean filter(ProbeData probeData) {
18: if (probeData.getStackSize() == 0) {
19: return false;
20: }
21:
22: String stackString = probeData.getStackEntry(0).toString();
23:
24: return stackString.equals("$assertionsDisabled")
25: || stackString
26: .endsWith(".desiredAssertionStatus()");
27: }
28: }
29: }
|