Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.eireneh.util
Class TestBase  view TestBase download TestBase.java

java.lang.Object
  extended bycom.eireneh.util.TestBase
Direct Known Subclasses:
ZTestUtil

public abstract class TestBase
extends java.lang.Object

A platform to help various SelfTest classes.
Distribution Licence:
Project B is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, by writing to Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, Or locally at the Licence link below.
The copyright to this program is held by it's authors.


Field Summary
protected static boolean fatal
          What to do when it all goes wrong
protected static java.io.PrintWriter out
          The place to print stuff
protected static long time
          For timing
 
Constructor Summary
TestBase()
           
 
Method Summary
static void fail()
          Something has definately gone wrong.
static void fail(java.lang.Object obj)
          Something has definately gone wrong.
static void fail(java.lang.Throwable ex)
          Something has definately gone wrong.
static void log(java.lang.Object data)
          Log something happening
static void logPackageStart(java.io.PrintWriter out, boolean fatal, java.lang.Class name)
          When a new package test starts
static void logPackageStop()
          When a new package test stops
static void reportTime()
          Take a new timestamp and print (not println) the time in seconds since the last calling of reportTime().
static void test(boolean ok)
          This allows us to do test(foo.equals(bar)); type tests.
static void test(double param1, double param2)
          This allows us to do test(1.0, 2.0); type tests.
static void test(long param1, long param2)
          This allows us to do test(1, 2); type tests.
static void test(java.lang.Object param1, java.lang.Object param2)
          This allows us to do test(foo, bar); type tests.
abstract  void test(java.io.PrintWriter out, boolean fatal)
          This should help people that want to run tests based on this class ...
static void test(java.lang.Throwable ex)
          Something has gone wrong - We report the problem.
 java.lang.String toString()
          So that we can use this in JLists and the like
private static void trace(java.lang.Throwable ex)
          Display a stack trace for an execption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

time

protected static long time
For timing


out

protected static java.io.PrintWriter out
The place to print stuff


fatal

protected static boolean fatal
What to do when it all goes wrong

Constructor Detail

TestBase

public TestBase()
Method Detail

test

public abstract void test(java.io.PrintWriter out,
                          boolean fatal)
This should help people that want to run tests based on this class ...


toString

public java.lang.String toString()
So that we can use this in JLists and the like


logPackageStart

public static void logPackageStart(java.io.PrintWriter out,
                                   boolean fatal,
                                   java.lang.Class name)
When a new package test starts


logPackageStop

public static void logPackageStop()
When a new package test stops


log

public static void log(java.lang.Object data)
Log something happening


test

public static final void test(java.lang.Object param1,
                              java.lang.Object param2)
This allows us to do test(foo, bar); type tests. We only take any action if (foo.equals(bar))


test

public static final void test(double param1,
                              double param2)
This allows us to do test(1.0, 2.0); type tests. We only take any action if (param1 != param2)


test

public static final void test(long param1,
                              long param2)
This allows us to do test(1, 2); type tests. We only take any action if (param1 != param2)


test

public static final void test(boolean ok)
This allows us to do test(foo.equals(bar)); type tests. We only take any action if ok is false.


fail

public static final void fail(java.lang.Throwable ex)
Something has definately gone wrong.


fail

public static final void fail()
Something has definately gone wrong.


fail

public static final void fail(java.lang.Object obj)
Something has definately gone wrong.


test

public static final void test(java.lang.Throwable ex)
Something has gone wrong - We report the problem. We insist that the caller passes us an exception - Maybe this is as a result of a real problem that something has caught, or more likely it is generated by calling new Error() when a test fails. It is used for the stack trace it contains.


trace

private static final void trace(java.lang.Throwable ex)
Display a stack trace for an execption


reportTime

public static final void reportTime()
Take a new timestamp and print (not println) the time in seconds since the last calling of reportTime().