org.jdiagnose
Class DiagnosticUnit

java.lang.Object
  extended byorg.jdiagnose.DiagnosticUnit
All Implemented Interfaces:
Diagnostic, DiagnosticContainer, DiagnosticUnitLifeCycle
Direct Known Subclasses:
BasicJdbcDiagnostic, CheckClassPathDiagnostic, DiagnoseDiagnostic, ExistsOnClasspathDiagnostic, FailingDiagnostic, HttpsUrlDiagnostic, HttpUrlDiagnostic, JavaVersionDiagnostic, JDKDiagnostic, PingableDiagnostic, SucceedingDiagnostic, TcpDiagnostic, TimeLimitDiagnostic

public class DiagnosticUnit
extends java.lang.Object
implements DiagnosticUnitLifeCycle, DiagnosticContainer, Diagnostic

A Diagnostic Unit. This behaves in a similar way to JUnit *Test classes. Subclass this method and when this diagnostic is run, any void methods that start with "diagnose" will be run. e.g. public class FailingDiagnostic extends DiagnosticUnit { public void diagnoseFailure() { assertTrue("False isn't True!", false); } } User: jamie Date: May 29, 2004 Time: 11:10:21 PM


Constructor Summary
DiagnosticUnit()
          Creates a new DiagnosticUnit.
DiagnosticUnit(java.lang.String name)
          Create a new DiagnosticUnit with a Fully Qualified Name
 
Method Summary
 void assertEquals(java.lang.Object toTestAgainst, java.lang.Object test)
          Assert that two objects are equal
 void assertEquals(java.lang.String msg, java.lang.Object toTestAgainst, java.lang.Object test)
          Assert that two objects are equal
 void assertNotNull(java.lang.Object test)
          Assert that an object is not null
 void assertNotNull(java.lang.String msg, java.lang.Object test)
          Assert that an object is not null
 void assertNull(java.lang.Object test)
          Assert that an object is null
 void assertNull(java.lang.String msg, java.lang.Object test)
          Assert that an object is null
 void assertTrue(boolean test)
          Assert that a test is true
 void assertTrue(java.lang.String msg, boolean test)
          Assert that a test is true
 void diagnose()
          Run this diagnostic.
 java.util.List getDiagnosticContainers()
           
 java.util.List getDiagnostics()
          Get the children Diagnostics of this diagnostic.
 java.lang.String getName()
          Returns the name of this diagnostic.
 void setUp()
          Set Up method.
 void tearDown()
          Tear Down method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiagnosticUnit

public DiagnosticUnit(java.lang.String name)
Create a new DiagnosticUnit with a Fully Qualified Name

Parameters:
name - the name of this diagnostic.

DiagnosticUnit

public DiagnosticUnit()
Creates a new DiagnosticUnit. It's name defaults to the FQ class name.

Method Detail

setUp

public void setUp()
           throws java.lang.Exception
Set Up method. Called before every "diagnose" method.

Specified by:
setUp in interface DiagnosticUnitLifeCycle
Throws:
java.lang.Exception

tearDown

public void tearDown()
              throws java.lang.Exception
Tear Down method. Called after every "diagnose" method.

Specified by:
tearDown in interface DiagnosticUnitLifeCycle
Throws:
java.lang.Exception

getName

public java.lang.String getName()
Returns the name of this diagnostic. Defaults to the FQ Class name.

Specified by:
getName in interface Diagnostic
Returns:
the name of the diagnostic

getDiagnostics

public java.util.List getDiagnostics()
Get the children Diagnostics of this diagnostic. Should be Diagnostics that run the "diagnose" methods on subclasses of this class.

Specified by:
getDiagnostics in interface DiagnosticContainer
Returns:
any children of this diagnostic, should be instance of org.jdiagnose.Diagnostic

assertTrue

public void assertTrue(java.lang.String msg,
                       boolean test)
Assert that a test is true

Parameters:
msg - a message if the assertion if false
test - the test to test

assertTrue

public void assertTrue(boolean test)
Assert that a test is true

Parameters:
test - the test to test

assertEquals

public void assertEquals(java.lang.String msg,
                         java.lang.Object toTestAgainst,
                         java.lang.Object test)
Assert that two objects are equal

Parameters:
msg - a message if the assertion if false
toTestAgainst - the object to test against
test - the test object

assertEquals

public void assertEquals(java.lang.Object toTestAgainst,
                         java.lang.Object test)
Assert that two objects are equal

Parameters:
toTestAgainst - the object to test against
test - the test object

assertNull

public void assertNull(java.lang.String msg,
                       java.lang.Object test)
Assert that an object is null

Parameters:
msg - a message if the assertion if false
test - the test object

assertNull

public void assertNull(java.lang.Object test)
Assert that an object is null

Parameters:
test - the test object

assertNotNull

public void assertNotNull(java.lang.String msg,
                          java.lang.Object test)
Assert that an object is not null

Parameters:
msg - a message if the assertion if false
test - the test object

assertNotNull

public void assertNotNull(java.lang.Object test)
Assert that an object is not null

Parameters:
test - the test object

getDiagnosticContainers

public java.util.List getDiagnosticContainers()
Specified by:
getDiagnosticContainers in interface DiagnosticContainer
See Also:
DiagnosticContainer.getDiagnosticContainers()

diagnose

public void diagnose()
              throws DiagnosticException
Description copied from interface: Diagnostic
Run this diagnostic.

Specified by:
diagnose in interface Diagnostic
Throws:
DiagnosticException - if the diagnostic failed
See Also:
Diagnostic.diagnose()


Copyright © 2004-2005 Grape Design Limited. All Rights Reserved.