org.picocontainer.defaults
Class InstanceComponentAdapterTestCase

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 org.picocontainer.tck.AbstractComponentAdapterTestCase
                          extended by org.picocontainer.defaults.InstanceComponentAdapterTestCase
All Implemented Interfaces:
junit.framework.Test

public class InstanceComponentAdapterTestCase
extends AbstractComponentAdapterTestCase

Test the InstanceComponentAdapter.

Since:
1.1
Author:
Jörg Schaible

Nested Class Summary
private static class InstanceComponentAdapterTestCase.LifecycleComponent
           
 
Nested classes/interfaces inherited from class org.picocontainer.tck.AbstractComponentAdapterTestCase
AbstractComponentAdapterTestCase.CollectingComponentAdapter, AbstractComponentAdapterTestCase.CycleDetectorComponentAdapter, AbstractComponentAdapterTestCase.NotInstantiatableComponentAdapter, AbstractComponentAdapterTestCase.RecordingLifecycleStrategy
 
Field Summary
 
Fields inherited from class org.picocontainer.tck.AbstractComponentAdapterTestCase
INSTANTIATING, RESOLVING, SERIALIZABLE, VERIFYING
 
Fields inherited from class org.jmock.core.MockObjectSupportTestCase
ANYTHING, NOT_NULL, NULL
 
Constructor Summary
InstanceComponentAdapterTestCase()
           
 
Method Summary
protected  int getComponentAdapterNature()
          
protected  java.lang.Class getComponentAdapterType()
          
protected  org.picocontainer.ComponentAdapter prepDEF_verifyDoesNotInstantiate(org.picocontainer.MutablePicoContainer picoContainer)
          Prepare the test verifyDoesNotInstantiate.
protected  org.picocontainer.ComponentAdapter prepDEF_verifyWithoutDependencyWorks(org.picocontainer.MutablePicoContainer picoContainer)
          Prepare the test verifyWithoutDependencyWorks.
protected  org.picocontainer.ComponentAdapter prepDEF_visitable()
          Prepare the test visitable.
protected  org.picocontainer.ComponentAdapter prepSER_isSerializable(org.picocontainer.MutablePicoContainer picoContainer)
          Prepare the test isSerializable.
protected  org.picocontainer.ComponentAdapter prepSER_isXStreamSerializable(org.picocontainer.MutablePicoContainer picoContainer)
          Prepare the test isXStreamSerializable.
 void testComponentAdapterCanIgnoreLifecycle()
           
 void testComponentAdapterReturnsSame()
           
 void testCustomLifecycleCanBeInjected()
           
 void testDefaultLifecycleStrategy()
           
 void testGuardAgainstNullInstance()
           
 
Methods inherited from class org.picocontainer.tck.AbstractComponentAdapterTestCase
createDefaultComponentAdapterFactory, prepDEF_isAbleToTakeParameters, prepINS_createsNewInstances, prepINS_errorIsRethrown, prepINS_normalExceptionIsRethrownInsidePicoInvocationTargetInitializationException, prepINS_runtimeExceptionIsRethrown, prepRES_dependenciesAreResolved, prepRES_failingInstantiationWithCyclicDependencyException, prepRES_failingVerificationWithCyclicDependencyException, prepVER_verificationFails, testDEF_isAbleToTakeParameters, testDEF_verifyDoesNotInstantiate, testDEF_verifyWithoutDependencyWorks, testDEF_visitable, testINS_createsNewInstances, testINS_errorIsRethrown, testINS_normalExceptionIsRethrownInsidePicoInvocationTargetInitializationException, testINS_runtimeExceptionIsRethrown, testRES_dependenciesAreResolved, testRES_failingInstantiationWithCyclicDependencyException, testRES_failingVerificationWithCyclicDependencyException, testSER_isSerializable, testSER_isXStreamSerializable, testSER_isXStreamSerializableWithPureReflection, testVER_verificationFails, wrapComponentInstances
 
Methods inherited from class org.jmock.MockObjectTestCase
atLeastOnce, atMostOnce, defaultMockNameForType, doAll, doAll, doAll, doAll, exactly, mock, mock, never, never, newCoreMock, newDummy, newDummy, newDummy, once, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, returnIterator, returnIterator, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, throwException
 
Methods inherited from class org.jmock.core.MockObjectSupportTestCase
and, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, collectionContaining, collectionContaining, compatibleType, contains, endsWith, eq, eq, eq, eq, eq, eq, eq, eq, eq, eq, hasProperty, hasProperty, isA, isIn, isIn, mapContaining, mapContaining, mapWithKey, mapWithKey, mapWithValue, mapWithValue, not, or, same, startsWith, stringContains, toString
 
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, setUp, tearDown, 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, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InstanceComponentAdapterTestCase

public InstanceComponentAdapterTestCase()
Method Detail

testComponentAdapterReturnsSame

public void testComponentAdapterReturnsSame()

testDefaultLifecycleStrategy

public void testDefaultLifecycleStrategy()

testCustomLifecycleCanBeInjected

public void testCustomLifecycleCanBeInjected()

testComponentAdapterCanIgnoreLifecycle

public void testComponentAdapterCanIgnoreLifecycle()

testGuardAgainstNullInstance

public void testGuardAgainstNullInstance()

getComponentAdapterType

protected java.lang.Class getComponentAdapterType()

Specified by:
getComponentAdapterType in class AbstractComponentAdapterTestCase
See Also:
AbstractComponentAdapterTestCase.getComponentAdapterType()

getComponentAdapterNature

protected int getComponentAdapterNature()

Overrides:
getComponentAdapterNature in class AbstractComponentAdapterTestCase
See Also:
AbstractComponentAdapterTestCase.getComponentAdapterNature()

prepDEF_verifyWithoutDependencyWorks

protected org.picocontainer.ComponentAdapter prepDEF_verifyWithoutDependencyWorks(org.picocontainer.MutablePicoContainer picoContainer)
Prepare the test verifyWithoutDependencyWorks.

Specified by:
prepDEF_verifyWithoutDependencyWorks in class AbstractComponentAdapterTestCase
Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test for a component without dependencies. Registration in the pico is not necessary.
See Also:
AbstractComponentAdapterTestCase.prepDEF_verifyWithoutDependencyWorks(org.picocontainer.MutablePicoContainer)

prepDEF_verifyDoesNotInstantiate

protected org.picocontainer.ComponentAdapter prepDEF_verifyDoesNotInstantiate(org.picocontainer.MutablePicoContainer picoContainer)
Prepare the test verifyDoesNotInstantiate.

Specified by:
prepDEF_verifyDoesNotInstantiate in class AbstractComponentAdapterTestCase
Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test for a component that may throw on instantiation. Registration in the pico is not necessary.
See Also:
AbstractComponentAdapterTestCase.prepDEF_verifyDoesNotInstantiate(org.picocontainer.MutablePicoContainer)

prepDEF_visitable

protected org.picocontainer.ComponentAdapter prepDEF_visitable()
Prepare the test visitable.

Specified by:
prepDEF_visitable in class AbstractComponentAdapterTestCase
Returns:
a ComponentAdapter of the type to test. If the ComponentAdapter supports Parameter, you have to select a component, that have some.
See Also:
AbstractComponentAdapterTestCase.prepDEF_visitable()

prepSER_isSerializable

protected org.picocontainer.ComponentAdapter prepSER_isSerializable(org.picocontainer.MutablePicoContainer picoContainer)
Prepare the test isSerializable. Overload this function, if the ComponentAdapter supports serialization.

Overrides:
prepSER_isSerializable in class AbstractComponentAdapterTestCase
Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test. Registration in the pico is not necessary.
See Also:
AbstractComponentAdapterTestCase.prepSER_isSerializable(org.picocontainer.MutablePicoContainer)

prepSER_isXStreamSerializable

protected org.picocontainer.ComponentAdapter prepSER_isXStreamSerializable(org.picocontainer.MutablePicoContainer picoContainer)
Prepare the test isXStreamSerializable. Overload this function, if the ComponentAdapter supports serialization.

Overrides:
prepSER_isXStreamSerializable in class AbstractComponentAdapterTestCase
Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test. Registration in the pico is not necessary.
See Also:
AbstractComponentAdapterTestCase.prepSER_isXStreamSerializable(org.picocontainer.MutablePicoContainer)