Expresso 5-5-0

com.jcorporate.expresso.core.cache
Class CacheTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bycom.jcorporate.expresso.services.test.ExpressoTestCase
              extended bycom.jcorporate.expresso.core.cache.CacheTest
All Implemented Interfaces:
junit.framework.Test

public class CacheTest
extends ExpressoTestCase

A test case to verify the functions of the Expresso CacheManager and related objects.

Since:
Expresso 4.0
Author:
Michael Nash

Constructor Summary
CacheTest(String name)
          Constructs a test case with the given name.
 
Method Summary
 int countTestCases()
          Counts the number of test cases executed by run(TestResult result).
static void main(String[] args)
           
 void setCacheName(String newName)
           
 void setUp()
          Sets up the fixture, for example, open a network connection.
static junit.framework.Test suite()
          Define the suite of tests that verify each function of the cache
 void tearDown()
          Tears down the fixture, for example, close a network connection.
 void testCreateCache()
          Test adding an item to a cache that does not exist to ensure it gets created
 void testCreateOrderedCache()
          Test adding an item to a cache that does not exist to ensure it gets created
 void testMultipleItems()
          Test multiple items to ensure the value and it's appropriate key are not being mixed up
 void testOrderedMultipleItems()
          Test multiple items to ensure the value and it's appropriate key are not being mixed up
 void testRandomCaches()
          All this class's goal is to try to test if we're going to get a java.util.ConcurrentModificationException or java.lang.NullPointerException.
 void testRelatedCaches()
           
 void testSimpleCaching()
          Most basic possible test.
 void testSimpleOrderedCaching()
          Most basic possible test.
 
Methods inherited from class com.jcorporate.expresso.services.test.ExpressoTestCase
getLog
 
Methods inherited from class junit.framework.TestCase
createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CacheTest

public CacheTest(String name)
          throws Exception
Constructs a test case with the given name.

Parameters:
name - the testname
Throws:
Exception - upon instantiation error
Method Detail

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

setCacheName

public void setCacheName(String newName)
Parameters:
newName - The new cache name

countTestCases

public int countTestCases()
Counts the number of test cases executed by run(TestResult result).

Returns:
integer (1)

setUp

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

Overrides:
setUp in class ExpressoTestCase
Throws:
Exception

tearDown

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

Overrides:
tearDown in class ExpressoTestCase
Throws:
Exception

testSimpleCaching

public void testSimpleCaching()
Most basic possible test. If you put something in a cache, can you get it back out again?


testSimpleOrderedCaching

public void testSimpleOrderedCaching()
Most basic possible test. If you put something in a cache, can you get it back out again?


testMultipleItems

public void testMultipleItems()
Test multiple items to ensure the value and it's appropriate key are not being mixed up


testOrderedMultipleItems

public void testOrderedMultipleItems()
Test multiple items to ensure the value and it's appropriate key are not being mixed up


testCreateCache

public void testCreateCache()
Test adding an item to a cache that does not exist to ensure it gets created


testCreateOrderedCache

public void testCreateOrderedCache()
Test adding an item to a cache that does not exist to ensure it gets created


testRelatedCaches

public void testRelatedCaches()

suite

public static junit.framework.Test suite()
                                  throws Exception
Define the suite of tests that verify each function of the cache

Returns:
junit.framework.TestSuite
Throws:
Exception

testRandomCaches

public void testRandomCaches()
All this class's goal is to try to test if we're going to get a java.util.ConcurrentModificationException or java.lang.NullPointerException. We write and trash various cache names. We don't care if the values exist, we're just randomly beating on the cache to try to get an exception


Expresso 5-5-0

Please see www.jcorporate.com for information about new Expresso releases.