: Class Test

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mortbay.Base
Class Test

    java.lang.Object
      |
      +--com.mortbay.Base.Test

public class Test
extends java.lang.Object

Test Harness and report. Test Harness for production of standard test reports:

          Test t1 = new Test("All_Pass");
          Test t2 = new Test("All_Fail");

          t1.check(true,"Boolean check that passes");
          t2.check(false,"Boolean check that fails");
          t1.checkEquals("Foo","Foo","Object comparison that passes");
          t2.checkEquals("Foo","Bar","Object comparison that fails");
          t1.checkEquals(1,1,"Long comparison that passes");
          t2.checkEquals(1,2,"Long comparison that fails");
          t1.checkEquals(1.1,1.1,"Double comparison that passes");
          t2.checkEquals(1.1,2.2,"Double comparison that fails");
          t1.checkEquals('a','a',"Char comparison that passes");
          t2.checkEquals('a','b',"Char comparison that fails");

          Test.report();

Version:
  $Id: Test.java,v 2.8 2000/03/22 17:53:56 gregw Exp $
Author:
  Greg Wilkins
See Also:
  `Code`

Constructor Summary
`Test(java.lang.String testCase)` Test constructor

Method Summary
`void` | `check(boolean b, java.lang.String check)` Check a boolean test case
`int` | `checkContains(java.lang.String string, int offset, java.lang.String subString, java.lang.String check)` Check that string contains a substring
`int` | `checkContains(java.lang.String string, java.lang.String subString, java.lang.String check)` Check that string contains a substring
`void` | `checkEquals(char c1, char c2, java.lang.String check)` Check a a pair of chars for equality
`void` | `checkEquals(double d1, double d2, java.lang.String check)` Check a a pair of doubles for equality
`void` | `checkEquals(java.io.InputStream in1, java.io.InputStream in2, java.lang.String check)` Check contents of a pair of InputStreams for equality
`void` | `checkEquals(long l1, long l2, java.lang.String check)` Check a a pair of longs for equality
`void` | `checkEquals(java.lang.Object o1, java.lang.Object o2, java.lang.String check)` Check a pair of objects for equality test case
`static void` | `report()` Produce test report

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Test

    public Test(java.lang.String testCase)

  Test constructor
  Parameters:
    `testCase` - the name of the test case

Method Detail

### check

    public void check(boolean b,
                      java.lang.String check)

  Check a boolean test case
  Parameters:
    `b` - Boolean to check
    `check` - Description of this check

### checkContains

    public int checkContains(java.lang.String string,
                             java.lang.String subString,
                             java.lang.String check)

  Check that string contains a substring
  Returns:
    Index of substring

### checkContains

    public int checkContains(java.lang.String string,
                             int offset,
                             java.lang.String subString,
                             java.lang.String check)

  Check that string contains a substring
  Returns:
    Index of substring

### checkEquals

    public void checkEquals(java.lang.Object o1,
                            java.lang.Object o2,
                            java.lang.String check)

  Check a pair of objects for equality test case
  Parameters:
    `o1` - First object to compare
    `o2` - Second object to compare
    `check` - Description of this check

### checkEquals

    public void checkEquals(long l1,
                            long l2,
                            java.lang.String check)

  Check a a pair of longs for equality
  Parameters:
    `l1` - First Long to compare
    `l2` - Second Long to compare
    `check` - Description of this check

### checkEquals

    public void checkEquals(double d1,
                            double d2,
                            java.lang.String check)

  Check a a pair of doubles for equality
  Parameters:
    `d1` - First double to compare
    `d2` - Second double to compare
    `check` - Description of this check

### checkEquals

    public void checkEquals(char c1,
                            char c2,
                            java.lang.String check)

  Check a a pair of chars for equality
  Parameters:
    `c1` - First char to compare
    `c2` - Second char to compare
    `check` - Description of this check

### checkEquals

    public void checkEquals(java.io.InputStream in1,
                            java.io.InputStream in2,
                            java.lang.String check)

  Check contents of a pair of InputStreams for equality
  Parameters:
    `in1` - First InputStream
    `in2` - Second InputStream
    `check` - Description

### report

    public static void report()

  Produce test report

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD