Package jfun.yan.containers

Examples of jfun.yan.containers.DefaultContainer


              assertNotNull(c);
          }
      }

      public void testThangCanBeInstantiatedWithArrayList() {
          Container pico = new DefaultContainer();
          pico.registerConstructor(Thingie.class);
          pico.registerConstructor(ArrayList.class, new Class[0]);
          assertNotNull(pico.getInstance(Thingie.class));
      }
View Full Code Here


          pico.registerConstructor(ArrayList.class, new Class[0]);
          assertNotNull(pico.getInstance(Thingie.class));
      }

      public void getComponentsOfTypeReturnsModifiableList() {
          Container pico = new DefaultContainer();
          pico.registerConstructor(Thingie.class);
          pico.getComponentsOfType(Thingie.class).add((Component)Components.value(null));
      }
View Full Code Here

              this.service = service;
          }
      }

      public void testDefaultPicoContainerReturnsNewInstanceForEachCallWhenUsingTransientComponentAdapter() {
          DefaultContainer picoContainer = new DefaultContainer();
          picoContainer.registerConstructor(Service.class);
          picoContainer.registerComponent(TransientComponent.class,
              Components.ctor(TransientComponent.class));
          TransientComponent c1 = (TransientComponent) picoContainer.getInstance(TransientComponent.class);
          TransientComponent c2 = (TransientComponent) picoContainer.getInstance(TransientComponent.class);
          assertNotSame(c1, c2);
          assertSame(c1.service, c2.service);
      }
View Full Code Here

          public DependsOnCollection(Collection c) {
          }
      }

      public void testShouldProvideInfoAboutDependingWhenAmbiguityHappens() {
          Container pico = new DefaultContainer();
          pico.registerValue(new ArrayList());
          pico.registerValue(new LinkedList());
          pico.registerConstructor(DependsOnCollection.class);
          try {
              pico.getInstanceOfType(DependsOnCollection.class);
              fail();
          } catch (AmbiguousComponentResolutionException expected) {
          }
      }
View Full Code Here

              fail();
          } catch (AmbiguousComponentResolutionException expected) {
          }
      }
      protected Container getContainerImpl(){
        return new DefaultContainer();
      }
View Full Code Here

TOP

Related Classes of jfun.yan.containers.DefaultContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.