KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hansel > probes > ExceptionProbe


1 package org.hansel.probes;
2
3 import org.hansel.Probe;
4 import org.hansel.ProbeData;
5
6 /**
7  * A probe for an exception handler or finally block
8  * @author Niklas Mehner.
9  */

10 public class ExceptionProbe extends MethodProbe {
11
12     private Probe methodProbe;
13
14     /**
15      * Create a new Probe.
16      * @param methodProbe MethodProbe of the method this probe is contained in.
17      * @param pd Data for this probe.
18      */

19     public ExceptionProbe(Probe methodProbe,
20                           ProbeData pd) {
21         super(pd);
22         assert methodProbe != null : "Method probe may not be null.";
23         this.methodProbe = methodProbe;
24     }
25
26     public boolean displayFailure() {
27         return super.displayFailure() && !methodProbe.displayFailure();
28     }
29
30     public String JavaDoc getFailureMessage() {
31         return "Exception handler or finally block not covered.";
32     }
33 }
34
Popular Tags