de.jdemo.framework
Class AbstractDemoCase

java.lang.Object
  extended by de.jdemo.framework.AbstractDemoCase
All Implemented Interfaces:
IDemo, IDemoCase, java.lang.Cloneable
Direct Known Subclasses:
DemoCase, GuiDemoCase, PlainDemoCase, SwtDemoCase

public abstract class AbstractDemoCase
extends java.lang.Object
implements IDemoCase, java.lang.Cloneable

Author:
Markus Gebhard

Constructor Summary
AbstractDemoCase()
           
AbstractDemoCase(java.lang.String name)
           
 
Method Summary
 void accept(IDemoVisitor visitor)
           
 void after()
           
protected static void assertNotNull(java.lang.String message, java.lang.Object object)
           
protected static void assertNull(java.lang.String message, java.lang.Object object)
           
protected static void assertTrue(java.lang.String message, boolean condition)
           
 void before()
           
 void cancel()
          Give this DemoCase the chance to exit.
protected  java.lang.Object clone()
          Returns a clone of this democase, that is a new instance being the same demonstration case, but not having any listeners or other temporary fields.
protected  java.lang.ThreadGroup createThreadGroup()
           
 void executeSetUp()
          Called by the DemoCaseRunner to invoke the setUp method.
 void executeTearDown()
          Called by the DemoCaseRunner to invoke the tearDown method.
protected  void exit()
          Can be called from within the demonstration code to indicate that this demonstration has been finished.
protected static void fail(java.lang.String message)
           
 IDemoCase getClone()
           
 DemoIdentifier getIdentifier()
           
 java.lang.String getName()
          Gets the demo method name of this DemoCase
protected  IDemoCaseRunnable getRunnable()
           
 void runDemo()
          Override to run the demo and assert its state.
 void setName(java.lang.String demoMethodName)
          Sets the name of this DemoCase
 void setRunnable(IDemoCaseRunnable runnable)
           
protected  void setUp()
          Sets up the fixture, for example, open a network connection.
protected  void tearDown()
          Tears down the fixture, for example, close a network connection.
 java.lang.String toString()
          Returns a string representation of the demo case id
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.jdemo.framework.IDemoCase
createRunnable
 

Constructor Detail

AbstractDemoCase

public AbstractDemoCase()

AbstractDemoCase

public AbstractDemoCase(java.lang.String name)
Method Detail

accept

public void accept(IDemoVisitor visitor)
Specified by:
accept in interface IDemo

setRunnable

public final void setRunnable(IDemoCaseRunnable runnable)

getRunnable

protected final IDemoCaseRunnable getRunnable()

fail

protected static void fail(java.lang.String message)

assertTrue

protected static void assertTrue(java.lang.String message,
                                 boolean condition)

assertNotNull

protected static void assertNotNull(java.lang.String message,
                                    java.lang.Object object)

assertNull

protected static void assertNull(java.lang.String message,
                                 java.lang.Object object)

setUp

protected void setUp()
              throws java.lang.Exception
Sets up the fixture, for example, open a network connection. This method is called before a demo is executed.

Throws:
java.lang.Exception

tearDown

protected void tearDown()
                 throws java.lang.Exception
Tears down the fixture, for example, close a network connection. This method is called after a demo is executed.

Throws:
java.lang.Exception

toString

public final java.lang.String toString()
Returns a string representation of the demo case id

Overrides:
toString in class java.lang.Object

getName

public final java.lang.String getName()
Gets the demo method name of this DemoCase

Specified by:
getName in interface IDemo
Returns:
the name of this demo case

setName

public final void setName(java.lang.String demoMethodName)
Sets the name of this DemoCase

Specified by:
setName in interface IDemo
Parameters:
demoMethodName - The name to set

exit

protected void exit()
Can be called from within the demonstration code to indicate that this demonstration has been finished.

See Also:
cancel()

clone

protected java.lang.Object clone()
Returns a clone of this democase, that is a new instance being the same demonstration case, but not having any listeners or other temporary fields. This is intended for starting each demo case from scratch.

Overrides:
clone in class java.lang.Object

getClone

public IDemoCase getClone()

getIdentifier

public final DemoIdentifier getIdentifier()
Specified by:
getIdentifier in interface IDemoCase

cancel

public void cancel()
Give this DemoCase the chance to exit. Can be overriden by subclasses e.g. to dispose windows or dispose other resources. Usually invoked from an IDemoCaseRunnable when the user requests termination of the Demo. Should not be called from within a demo.


before

public final void before()
                  throws java.lang.Exception
Throws:
java.lang.Exception

after

public final void after()
                 throws java.lang.Exception
Throws:
java.lang.Exception

executeSetUp

public void executeSetUp()
                  throws java.lang.Exception
Called by the DemoCaseRunner to invoke the setUp method. Should not be called from within a demo.

Throws:
java.lang.Exception

executeTearDown

public void executeTearDown()
                     throws java.lang.Exception
Called by the DemoCaseRunner to invoke the tearDown method. Should not be called from within a demo.

Throws:
java.lang.Exception

createThreadGroup

protected java.lang.ThreadGroup createThreadGroup()

runDemo

public void runDemo()
             throws java.lang.Throwable
Override to run the demo and assert its state.

Throws:
java.lang.Throwable - if any exception is thrown


JDemo homepage: http://www.jdemo.de
Copyright © 2003-2008 Markus Gebhard. All Rights Reserved.