View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.jdiagnose.library;
17  
18  import org.jdiagnose.DiagnosticUnit;
19  import org.jdiagnose.DiagnosticException;
20  
21  /***
22   * A Diagnostic that always fails. Useful to test what happens when Diagnostics
23   * fail (e.g. if you're sending emails on failure).
24   * 
25   * User: jamie
26   * Date: Jun 4, 2004
27   * Time: 7:37:33 PM
28   */
29  public class FailingDiagnostic extends DiagnosticUnit {
30  
31      /***
32       * Default Constructor 
33       */
34      public FailingDiagnostic() {
35          super();
36      }
37  
38      /*** 
39       * Construct with new fqn
40       * @param name the fully qualified name of this diagnostic
41       */
42      public FailingDiagnostic(String name) {
43          super(name);
44      }
45  
46      /***
47       * Diagnose a failure
48       * @throws DiagnosticException always thrown.
49       */
50      public void diagnoseFailure() throws DiagnosticException {
51          throw new DiagnosticException("FailingDiagnostic always fails");
52      }
53  }