PicoContainer
  1. PicoContainer
  2. PICO-397

as() does not work correctly for any containers based on AbstractDelegatingMutablePicoContainer

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0
    • Component/s: PicoContainer (Java)
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      The following test case will fail on any container based on AbstractDelegatingPicoContainer:

          @Test
          public void testAsPropagatesForExactlyOneInvocation() {
              MutablePicoContainer mpc = createPicoContainer(null);
              mpc.change(Characteristics.CACHE);
              
              mpc
              	.as(Characteristics.CACHE).addComponent("bufferTwo", StringBuffer.class, DefaultConstructorParameter.INSTANCE)
              	.as(Characteristics.NO_CACHE).addComponent("bufferOne", StringBuffer.class, DefaultConstructorParameter.INSTANCE)
              	.addComponent("bufferThree", StringBuffer.class, DefaultConstructorParameter.INSTANCE);
              
              assertNotSame(mpc.getComponent("bufferOne"), mpc.getComponent("bufferOne"));
              assertSame(mpc.getComponent("bufferTwo"), mpc.getComponent("bufferTwo"));
              
              //Default behavior is caching.
              assertSame(mpc.getComponent("bufferThree"), mpc.getComponent("bufferThree"));
          	
          }
      

        People

        • Assignee:
          Michael Rimov
          Reporter:
          Michael Rimov
        • Votes:
          0 Vote for this issue
          Watchers:
          1 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: