org.picocontainer.defaults
Class ConstructorInjectionComponentAdapterTestCase

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.ConstructorInjectionComponentAdapterTestCase
All Implemented Interfaces:
junit.framework.Test

public class ConstructorInjectionComponentAdapterTestCase
extends AbstractComponentAdapterTestCase


Nested Class Summary
static class ConstructorInjectionComponentAdapterTestCase.A
           
static class ConstructorInjectionComponentAdapterTestCase.B
           
private static class ConstructorInjectionComponentAdapterTestCase.BarfingActionListener
           
static class ConstructorInjectionComponentAdapterTestCase.C1
           
static class ConstructorInjectionComponentAdapterTestCase.C2
           
static class ConstructorInjectionComponentAdapterTestCase.Component201
           
static class ConstructorInjectionComponentAdapterTestCase.Erroneous
           
 class ConstructorInjectionComponentAdapterTestCase.IllegalAccessExceptionThrowing
           
 class ConstructorInjectionComponentAdapterTestCase.InstantiationExceptionThrowing
           
static class ConstructorInjectionComponentAdapterTestCase.NamedDependsOnTouchable
           
static class ConstructorInjectionComponentAdapterTestCase.NormalExceptionThrowing
           
private static class ConstructorInjectionComponentAdapterTestCase.NotYourBusiness
           
private static class ConstructorInjectionComponentAdapterTestCase.Private
           
static class ConstructorInjectionComponentAdapterTestCase.RuntimeThrowing
           
 
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
ConstructorInjectionComponentAdapterTestCase()
           
 
Method Summary
protected  java.lang.Class getComponentAdapterType()
           
protected  org.picocontainer.ComponentAdapter prepDEF_isAbleToTakeParameters(org.picocontainer.MutablePicoContainer picoContainer)
          Prepare the test isAbleToTakeParameters.
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 prepINS_createsNewInstances(org.picocontainer.MutablePicoContainer picoContainer)
          Prepare the test createsNewInstances.
protected  org.picocontainer.ComponentAdapter prepINS_errorIsRethrown(org.picocontainer.MutablePicoContainer picoContainer)
          Prepare the test errorIsRethrown.
protected  org.picocontainer.ComponentAdapter prepINS_normalExceptionIsRethrownInsidePicoInvocationTargetInitializationException(org.picocontainer.MutablePicoContainer picoContainer)
          Prepare the test normalExceptionIsRethrownInsidePicoInvocationTargetInitializationException.
protected  org.picocontainer.ComponentAdapter prepINS_runtimeExceptionIsRethrown(org.picocontainer.MutablePicoContainer picoContainer)
          Prepare the test runtimeExceptionIsRethrown.
protected  org.picocontainer.ComponentAdapter prepRES_dependenciesAreResolved(org.picocontainer.MutablePicoContainer picoContainer)
          Prepare the test dependenciesAreResolved.
protected  org.picocontainer.ComponentAdapter prepRES_failingInstantiationWithCyclicDependencyException(org.picocontainer.MutablePicoContainer picoContainer)
          Prepare the test failingInstantiationWithCyclicDependencyException.
protected  org.picocontainer.ComponentAdapter prepRES_failingVerificationWithCyclicDependencyException(org.picocontainer.MutablePicoContainer picoContainer)
          Prepare the test failingVerificationWithCyclicDependencyException.
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.
protected  org.picocontainer.ComponentAdapter prepVER_verificationFails(org.picocontainer.MutablePicoContainer picoContainer)
          Prepare the test verificationFailsWithUnsatisfiedDependency.
 void testCustomLifecycleCanBeInjected()
           
 void testInstantiationExceptionThrownInCtorIsRethrownInsideInvocationTargetExeption()
           
 void testMonitoringHappensBeforeAndAfterInstantiation()
           
 void testMonitoringHappensBeforeAndOnFailOfImpossibleComponentsInstantiation()
           
 void testNormalExceptionThrownInCtorIsRethrownInsideInvocationTargetExeption()
           
 void testPicoInitializationExceptionThrownBecauseOfFilteredConstructors()
           
 void testRegisterAbstractShouldFail()
           
 void testShouldBeAbleToInstantiateNonPublicClassesWithNonPublicConstructors()
           
 void testShouldNotConsiderNonPublicConstructors()
           
 void XXXtestIllegalAccessExceptionThrownInCtorIsRethrownInsideInvocationTargetExeption()
           
 
Methods inherited from class org.picocontainer.tck.AbstractComponentAdapterTestCase
createDefaultComponentAdapterFactory, getComponentAdapterNature, 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

ConstructorInjectionComponentAdapterTestCase

public ConstructorInjectionComponentAdapterTestCase()
Method Detail

getComponentAdapterType

protected java.lang.Class getComponentAdapterType()
Specified by:
getComponentAdapterType in class AbstractComponentAdapterTestCase

prepDEF_verifyWithoutDependencyWorks

protected org.picocontainer.ComponentAdapter prepDEF_verifyWithoutDependencyWorks(org.picocontainer.MutablePicoContainer picoContainer)
Description copied from class: AbstractComponentAdapterTestCase
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.

prepDEF_verifyDoesNotInstantiate

protected org.picocontainer.ComponentAdapter prepDEF_verifyDoesNotInstantiate(org.picocontainer.MutablePicoContainer picoContainer)
Description copied from class: AbstractComponentAdapterTestCase
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.

prepDEF_visitable

protected org.picocontainer.ComponentAdapter prepDEF_visitable()
Description copied from class: AbstractComponentAdapterTestCase
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.

prepDEF_isAbleToTakeParameters

protected org.picocontainer.ComponentAdapter prepDEF_isAbleToTakeParameters(org.picocontainer.MutablePicoContainer picoContainer)
Description copied from class: AbstractComponentAdapterTestCase
Prepare the test isAbleToTakeParameters. Overload this function, if the ComponentAdapter to test supports Parameter.

Overrides:
prepDEF_isAbleToTakeParameters in class AbstractComponentAdapterTestCase
Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test. Select a component, that has some parameters. Registration in the pico is not necessary.

prepSER_isSerializable

protected org.picocontainer.ComponentAdapter prepSER_isSerializable(org.picocontainer.MutablePicoContainer picoContainer)
Description copied from class: AbstractComponentAdapterTestCase
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.

prepSER_isXStreamSerializable

protected org.picocontainer.ComponentAdapter prepSER_isXStreamSerializable(org.picocontainer.MutablePicoContainer picoContainer)
Description copied from class: AbstractComponentAdapterTestCase
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.

prepVER_verificationFails

protected org.picocontainer.ComponentAdapter prepVER_verificationFails(org.picocontainer.MutablePicoContainer picoContainer)
Description copied from class: AbstractComponentAdapterTestCase
Prepare the test verificationFailsWithUnsatisfiedDependency. Overload this function, if the ComponentAdapter's verification can fail e.g. due to an unresolved dependency.

Overrides:
prepVER_verificationFails in class AbstractComponentAdapterTestCase
Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test, that fails for the verification, e.g. because of a compoennt with missing dependencies. Registration in the pico is not necessary.

prepINS_createsNewInstances

protected org.picocontainer.ComponentAdapter prepINS_createsNewInstances(org.picocontainer.MutablePicoContainer picoContainer)
Description copied from class: AbstractComponentAdapterTestCase
Prepare the test createsNewInstances. Overload this function, if the ComponentAdapter is instantiating. It should create a new instance with every call.

Overrides:
prepINS_createsNewInstances 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.

prepINS_errorIsRethrown

protected org.picocontainer.ComponentAdapter prepINS_errorIsRethrown(org.picocontainer.MutablePicoContainer picoContainer)
Description copied from class: AbstractComponentAdapterTestCase
Prepare the test errorIsRethrown. Overload this function, if the ComponentAdapter is instantiating.

Overrides:
prepINS_errorIsRethrown in class AbstractComponentAdapterTestCase
Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test with a component that fails with an Error at instantiation. Registration in the pico is not necessary.

prepINS_runtimeExceptionIsRethrown

protected org.picocontainer.ComponentAdapter prepINS_runtimeExceptionIsRethrown(org.picocontainer.MutablePicoContainer picoContainer)
Description copied from class: AbstractComponentAdapterTestCase
Prepare the test runtimeExceptionIsRethrown. Overload this function, if the ComponentAdapter is instantiating.

Overrides:
prepINS_runtimeExceptionIsRethrown in class AbstractComponentAdapterTestCase
Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test with a component that fails with a RuntimeException at instantiation. Registration in the pico is not necessary.

prepINS_normalExceptionIsRethrownInsidePicoInvocationTargetInitializationException

protected org.picocontainer.ComponentAdapter prepINS_normalExceptionIsRethrownInsidePicoInvocationTargetInitializationException(org.picocontainer.MutablePicoContainer picoContainer)
Description copied from class: AbstractComponentAdapterTestCase
Prepare the test normalExceptionIsRethrownInsidePicoInvocationTargetInitializationException. Overload this function, if the ComponentAdapter is instantiating.

Overrides:
prepINS_normalExceptionIsRethrownInsidePicoInvocationTargetInitializationException in class AbstractComponentAdapterTestCase
Parameters:
picoContainer - container, may probably not be used.
Returns:
a ComponentAdapter of the type to test with a component that fails with a PicoInvocationTargetInitializationException at instantiation. Registration in the pico is not necessary.

prepRES_dependenciesAreResolved

protected org.picocontainer.ComponentAdapter prepRES_dependenciesAreResolved(org.picocontainer.MutablePicoContainer picoContainer)
Description copied from class: AbstractComponentAdapterTestCase
Prepare the test dependenciesAreResolved. Overload this function, if the ComponentAdapter is resolves dependencies.

Overrides:
prepRES_dependenciesAreResolved in class AbstractComponentAdapterTestCase
Parameters:
picoContainer - container, used to register dependencies.
Returns:
a ComponentAdapter of the type to test with a component that has dependencies. Registration in the pico is not necessary.

prepRES_failingVerificationWithCyclicDependencyException

protected org.picocontainer.ComponentAdapter prepRES_failingVerificationWithCyclicDependencyException(org.picocontainer.MutablePicoContainer picoContainer)
Description copied from class: AbstractComponentAdapterTestCase
Prepare the test failingVerificationWithCyclicDependencyException. Overload this function, if the ComponentAdapter is resolves dependencies.

Overrides:
prepRES_failingVerificationWithCyclicDependencyException in class AbstractComponentAdapterTestCase
Parameters:
picoContainer - container, used to register dependencies.
Returns:
a ComponentAdapter of the type to test with a component that has cyclic dependencies. You have to register the component itself in the pico.

prepRES_failingInstantiationWithCyclicDependencyException

protected org.picocontainer.ComponentAdapter prepRES_failingInstantiationWithCyclicDependencyException(org.picocontainer.MutablePicoContainer picoContainer)
Description copied from class: AbstractComponentAdapterTestCase
Prepare the test failingInstantiationWithCyclicDependencyException. Overload this function, if the ComponentAdapter is resolves dependencies.

Overrides:
prepRES_failingInstantiationWithCyclicDependencyException in class AbstractComponentAdapterTestCase
Parameters:
picoContainer - container, used to register dependencies.
Returns:
a ComponentAdapter of the type to test with a component that has cyclic dependencies. You have to register the component itself in the pico.

testNormalExceptionThrownInCtorIsRethrownInsideInvocationTargetExeption

public void testNormalExceptionThrownInCtorIsRethrownInsideInvocationTargetExeption()

testInstantiationExceptionThrownInCtorIsRethrownInsideInvocationTargetExeption

public void testInstantiationExceptionThrownInCtorIsRethrownInsideInvocationTargetExeption()

XXXtestIllegalAccessExceptionThrownInCtorIsRethrownInsideInvocationTargetExeption

public void XXXtestIllegalAccessExceptionThrownInCtorIsRethrownInsideInvocationTargetExeption()

testPicoInitializationExceptionThrownBecauseOfFilteredConstructors

public void testPicoInitializationExceptionThrownBecauseOfFilteredConstructors()

testRegisterAbstractShouldFail

public void testRegisterAbstractShouldFail()
                                    throws org.picocontainer.PicoRegistrationException,
                                           org.picocontainer.PicoIntrospectionException
Throws:
org.picocontainer.PicoRegistrationException
org.picocontainer.PicoIntrospectionException

testShouldBeAbleToInstantiateNonPublicClassesWithNonPublicConstructors

public void testShouldBeAbleToInstantiateNonPublicClassesWithNonPublicConstructors()

testShouldNotConsiderNonPublicConstructors

public void testShouldNotConsiderNonPublicConstructors()

testMonitoringHappensBeforeAndAfterInstantiation

public void testMonitoringHappensBeforeAndAfterInstantiation()
                                                      throws java.lang.NoSuchMethodException
Throws:
java.lang.NoSuchMethodException

testMonitoringHappensBeforeAndOnFailOfImpossibleComponentsInstantiation

public void testMonitoringHappensBeforeAndOnFailOfImpossibleComponentsInstantiation()
                                                                             throws java.lang.NoSuchMethodException
Throws:
java.lang.NoSuchMethodException

testCustomLifecycleCanBeInjected

public void testCustomLifecycleCanBeInjected()
                                      throws java.lang.NoSuchMethodException
Throws:
java.lang.NoSuchMethodException