Package jfun.yan

Examples of jfun.yan.Container.verify()


    public void testRegisteredComponentsExistAndAreTheCorrectTypes()
    throws Exception{
        Container yan = createPicoContainerWithTouchableAndDependsOnTouchable();
        yan = trans(yan);
        yan.verify();
        assertNotNull("Container should have Touchable component",
                yan.getInstance(Touchable.class));
        assertNotNull("Container should have DependsOnTouchable component",
                yan.getInstance(DependsOnTouchable.class));
        assertTrue("Component should be instance of Touchable",
View Full Code Here


      final Container yan = createYanContainer();
      yan.registerComponent(
          Components.ctor(PersonBean.class, new Class[]{String.class})
          .withArgument(0, Components.value(new int[0])));
      try{
        yan.verify();
        fail("should have type failed");
      }
      catch(ParameterTypeMismatchException e){
        assertEquals(2, e.getResolutionTrace().size());
        assertParameter(e, 0, Functions.ctor(PersonBean.class, new Class[]{String.class}),
View Full Code Here

      final HashMap props = new HashMap();
      props.put("name", Components.ctor(ArrayList.class, null));
      yan.registerComponent(Components.bean(PersonBean.class)
          .withProperties(props));
      try{
        yan.verify();
        fail("should have type failed");
      }
      catch(PropertyTypeMismatchException e){
        //e.printResolutionTrace(System.err);
        assertEquals(3, e.getResolutionTrace().size());
View Full Code Here

      }
      assertEquals(yan, yan);
      assertEquals(yan.toString(), yan.toString());
      yan.registerComponent("target", Components.method(this, "expectArray"));
      try{
        yan.verify();
        fail("should have failed with IrresolveableArgumentException");
      }
      catch(IrresolveableArgumentException e){
        assertEquals("target", e.getComponentKey());
        assertEquals(int[][].class, e.getParameterType());
View Full Code Here

      }
      catch(UnknownComponentTypeException e){
        assertTraceSize(e, 0);
      }
      yan.unregisterComponentsOfType(int.class);
      yan.verify();
      yan.registerComponent("target_also", Components.useKey("target"));
      try{
        yan.verify();
        fail("should have failed with UnresolvedComponentException");
      }
View Full Code Here

      }
      yan.unregisterComponentsOfType(int.class);
      yan.verify();
      yan.registerComponent("target_also", Components.useKey("target"));
      try{
        yan.verify();
        fail("should have failed with UnresolvedComponentException");
      }
      catch(UnresolvedComponentException e){
        assertEquals("target", e.getComponentKey());
      }
View Full Code Here

      }
      yan.registerComponent("target",
          Components.method(this, "expectArray")
          .withArgument(0, Components.value(new int[10])));
      try{
        yan.verify();
        fail("should have failed with ParameterTypeMismatchException");
      }
      catch(ParameterTypeMismatchException e){
        assertTraceSize(e, 3);
        assertParameter(e, 0, Functions.method(this, "expectArray"), 0);
View Full Code Here

    }*/
    public void testUseBadContainerKeyAndContainerType(){
      final Container yan = createYanContainer();
      yan.registerComponent("use_bad", Components.useKey(yan, "badkey"));
      try{
        yan.verify();
        fail("should have failed with UnresolvedComponentException");
      }
      catch(UnresolvedComponentException e){
        assertEquals("badkey", e.getComponentKey());
        yan.unregisterComponent("use_bad");
View Full Code Here

      }
      yan.registerValue(char.class, new Character('a'));
      yan.registerComponent("use_badtype",
          Components.useType(createYanContainer(), char.class));
      try{
        yan.verify();
        fail("should have failed with UnresolvedComponentException");
      }
      catch(UnresolvedComponentException e){
        assertEquals(char.class, e.getComponentKey());
        yan.unregisterComponent("use_badtype");
View Full Code Here

    }
    public void testUseBadKeyAndType(){
      final Container yan = createYanContainer();
      yan.registerComponent("use_bad", Components.useKey("badkey"));
      try{
        yan.verify();
        fail("should have failed with UnresolvedComponentException");
      }
      catch(UnresolvedComponentException e){
        assertEquals("badkey", e.getComponentKey());
        yan.unregisterComponent("use_bad");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.