com.livescribe.penunit.framework
Class PenletTestCase

java.lang.Object
  extended by j2meunit.framework.Assert
      extended by j2meunit.framework.TestCase
          extended by com.livescribe.penunit.framework.PenletTestCase
All Implemented Interfaces:
Test

public class PenletTestCase
extends TestCase

PenletTestCase is an extension of TestCase that provides access to an initialized Penlet. Most of the Penlet implementation needs a PenletContext to perform useful functions, which can only be present when the Penlet is initialized (when com.livescribe.penlet.Penlet#initApp() is called}.

Test cases that extend from PenletTestCase can call getPenlet() within the testcase method to get access to the Penlet. Note that if the extension class overrides TestCase.setUp() and/or TestCase.tearDown(), then they should call the super's version, so that the penlet class can be initialized.

Author:
shivag

Constructor Summary
PenletTestCase(java.lang.String penletClassName)
           
PenletTestCase(java.lang.String name, java.lang.String penletClassName)
           
PenletTestCase(java.lang.String name, TestMethod testMethod, java.lang.String penletClassName)
           
 
Method Summary
static PageInstance getPageInstance(int page, int copy, long pageAddress)
           
static PageInstance getPageInstance(int page, int copy, java.lang.String pageAddress)
           
protected  Penlet getPenlet()
          Returns the initialized Penlet.
protected  RegionCollection getRegionCollection(PageInstance instance)
          Returns the region collection associated with a page.
protected  void setUp()
          Loads the penlet associated with the testcase.
protected  void tearDown()
          UnLoads the penlet associated with the testcase.
 
Methods inherited from class j2meunit.framework.TestCase
countTestCases, countTestSteps, createResult, getName, getTestMethod, getTestMethodName, onAssertion, run, run, runBare, runTest, setName, setTestMethod, setTestMethod, setTestMethodName, suite, testStepFinished, toString
 
Methods inherited from class j2meunit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PenletTestCase

public PenletTestCase(java.lang.String penletClassName)

PenletTestCase

public PenletTestCase(java.lang.String name,
                      java.lang.String penletClassName)
Parameters:
name -

PenletTestCase

public PenletTestCase(java.lang.String name,
                      TestMethod testMethod,
                      java.lang.String penletClassName)
Parameters:
name -
testMethod -
Method Detail

setUp

protected void setUp()
Loads the penlet associated with the testcase. Extensions to this class that overrides this method MUST call super.setUp() before setting up the testcase fixture.

Overrides:
setUp in class TestCase

tearDown

protected void tearDown()
UnLoads the penlet associated with the testcase. Extensions to this class that overrides this method MUST call super.tearDown() after tearing down testcase related data.

Overrides:
tearDown in class TestCase

getPenlet

protected Penlet getPenlet()
Returns the initialized Penlet. This can return null if not called from a testcase method. See setUp() and tearDown() for details

Returns:

getRegionCollection

protected RegionCollection getRegionCollection(PageInstance instance)
Returns the region collection associated with a page. This can return null if not called from a testcase method. See setUp() and tearDown() for details

Parameters:
instance - page instance. This should be a non-null value
Returns:

getPageInstance

public static PageInstance getPageInstance(int page,
                                           int copy,
                                           java.lang.String pageAddress)

getPageInstance

public static PageInstance getPageInstance(int page,
                                           int copy,
                                           long pageAddress)