1 package org.hansel; 2 3 import org.hansel.probes.ProbeFilter; 4 5 public class AssertionCoverageDecorator extends CoverageDecorator { 6 7 public AssertionCoverageDecorator(Class [] classesCovered) { 8 super(classesCovered, new AssertionProbeFilter()); 9 } 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.endsWith(".desiredAssertionStatus()"); 26 } 27 } 28 } 29 | Popular Tags |