Package jfun.yan

Examples of jfun.yan.Container.verify()


   
    final Component factory =
      mycache.factory(ICacheFactory2.class);
    yan.registerComponent("target", factory);
    try{
      yan.verify();
      fail("should have failed with ParameterTypeMismatchException");
    }
    catch(ParameterTypeMismatchException e){
      assertEquals(0, e.getOrdinalPosition());
      assertEquals(String.class, e.getExpectedType());
View Full Code Here


   
    final Component factory =
      mycache.factory(tests.jfun.yan.testmodel.IMonitoredCacheFactory.class);
    yan.registerComponent("target", factory);
    try{
      yan.verify();
      fail("should have failed with ReturnTypeMismatchException");
    }
    catch(ReturnTypeMismatchException e){
      //e.printResolutionTrace();
      assertEquals("tests.jfun.yan.testmodel.MyCache cannot match return type of <public abstract tests.jfun.yan.testmodel.IMonitoredCache tests.jfun.yan.testmodel.IMonitoredCacheFactory.createCache(java.lang.String,int)>",
View Full Code Here

        return lhm;
      }
    }).cast(LinkedHashMap.class);
    yan.registerComponent(cc);
    yan.registerComponent("factory", factory);
    yan.verify();
    final LinkedHashMap lhm = (LinkedHashMap)yan.getInstance(LinkedHashMap.class);
    verifyLinkedHashMap(lhm);

  }
  public void testCreateLinkedHashMapUsingMap2(){
View Full Code Here

        return lhm;
      }
    }).cast(LinkedHashMap.class);
    yan.registerComponent(cc);
    yan.registerComponent("factory", factory);
    yan.verify();
    final LinkedHashMap lhm = (LinkedHashMap)yan.getInstance(LinkedHashMap.class);
    verifyLinkedHashMap(lhm);
  }
  public void testCreateLinkedHashMapUsingBind(){
    final Container yan = createYanContainer();
View Full Code Here

        return Components.value(lhm);
      }
    }).cast(LinkedHashMap.class);
    yan.registerComponent(cc);
    yan.registerComponent("factory", factory);
    yan.verify();
    final LinkedHashMap lhm = (LinkedHashMap)yan.getInstance(LinkedHashMap.class);
    verifyLinkedHashMap(lhm);
  }
  private void verifyLinkedHashMap(final LinkedHashMap lhm){
    assertEquals(3, lhm.size());
View Full Code Here

    yan.registerComponent("target", Components.array(
        new Component[]{Components.value("hello"),
            Components.useKey("age")}, CharSequence.class));
   
    try{
      yan.verify();
      fail("should have failed with illegal argument");
    }
    catch(TypeMismatchException e){
      assertEquals("type mismatch: the #1 element is of java.lang.Integer, while java.lang.CharSequence is expected.", e.getMessage());
    }
View Full Code Here

    final tests.jfun.yan.testmodel.ICache icache = ifactory.createCache("tom", 10);
    assertEquals(MyCache.class, icache.getClass());
    assertEquals("tom", icache.getName());
    assertEquals(10, icache.getCapacity());
    try{
      yan.verify();
      fail("should have failed with IrresolveableArgumentException");
    }
    catch(IrresolveableArgumentException e){
      assertTraceSize(e, 3);
      assertEntry(e, 1, "tests.jfun.yan.testmodel.ICacheFactory");
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.