com.bm.testsuite.mocked
Class MockedSessionBeanFixture<T>

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.jmock.core.VerifyingTestCase
              extended by org.jmock.core.MockObjectSupportTestCase
                  extended by org.jmock.MockObjectTestCase
                      extended by com.bm.testsuite.BaseTest
                          extended by com.bm.testsuite.mocked.MockedSessionBeanFixture<T>
Type Parameters:
T - - the type of the bena to test.
All Implemented Interfaces:
junit.framework.Test

public abstract class MockedSessionBeanFixture<T>
extends BaseTest

This class enables the testing of Seteless/Statefull Session beans and JBoss Service classes under Mock-Isolation control. All JSR 220 (EJB 3) fields will be injected as JMock objects.

Author:
Daniel Wiese

Field Summary
 
Fields inherited from class org.jmock.core.MockObjectSupportTestCase
ANYTHING, NOT_NULL, NULL
 
Constructor Summary
MockedSessionBeanFixture(java.lang.Class<T> beanToTest)
          Default constructor.
 
Method Summary
protected  T getBeanToTest()
          Returns the bean to test.
protected  org.jmock.Mock getMockControl(java.lang.Class<?> interfaze)
          Returns the mock controll to the given property.
protected  void setUp()
           
protected  void setValueForField(java.lang.String fieldName, java.lang.Object toSet)
          Sets a value for a field in the tested-bean instance.
protected  void tearDown()
           
 
Methods inherited from class com.bm.testsuite.BaseTest
assertCollectionsEqual, assertFalse, assertFalse, assertInstanceOf, assertInstanceOf, setValueForField, testNothing
 
Methods inherited from class org.jmock.MockObjectTestCase
atLeastOnce, defaultMockNameForType, mock, mock, never, newCoreMock, once, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, throwException
 
Methods inherited from class org.jmock.core.MockObjectSupportTestCase
and, eq, eq, eq, eq, eq, eq, eq, eq, eq, eq, isA, newDummy, newDummy, newDummy, not, or, same, stringContains
 
Methods inherited from class org.jmock.core.VerifyingTestCase
registerToVerify, runBare, unregisterToVerify, verify
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, 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, 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

MockedSessionBeanFixture

public MockedSessionBeanFixture(java.lang.Class<T> beanToTest)
Default constructor.

Parameters:
beanToTest - - the bean to test.
Method Detail

getMockControl

protected org.jmock.Mock getMockControl(java.lang.Class<?> interfaze)
Returns the mock controll to the given property.

Parameters:
interfaze - - the name of the property
Returns:
- the mock controll

getBeanToTest

protected T getBeanToTest()
Returns the bean to test.

Returns:
- the bean to test

setValueForField

protected void setValueForField(java.lang.String fieldName,
                                java.lang.Object toSet)
Sets a value for a field in the tested-bean instance.

Parameters:
fieldName - - the name of the field
toSet - - the value to set
Since:
02.05.2006

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception
See Also:
TestCase.setUp()

tearDown

protected void tearDown()
                 throws java.lang.Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception
See Also:
TestCase.tearDown()


Copyright © 2008. All Rights Reserved.