/** @throws ClassNotFoundException */ @Test public void testResolveServiceC() throws ClassNotFoundException { final BaseSummoner summoner = new BaseSummoner(); summoner.setSummonResolver( new CompositeSummonResolver( new Vector<IServiceSummoner>() { { add(summoner); } })); ServiceA a = new ServiceA(); ServiceB b = new ServiceB(); ServiceC c = new ServiceC(); summoner.registerServiceFor(a.getClass().getCanonicalName(), a); summoner.registerServiceFor(b.getClass().getCanonicalName(), b); summoner.registerServiceFor(c.getClass().getCanonicalName(), c); SummonableService resolved = summoner.get(c.getClass().getCanonicalName(), c); summoner.resolveSummons(); assertEquals(c.getClass(), resolved.getClass()); assertTrue(b.equals(c.b)); assertTrue(a.equals(c.a)); }
/** @throws ClassNotFoundException */ @Test public void testResolveServiceA() throws ClassNotFoundException { final BaseSummoner summoner = new BaseSummoner(); summoner.setSummonResolver( new CompositeSummonResolver( new Vector<IServiceSummoner>() { { add(summoner); } })); ServiceA a = new ServiceA(); summoner.registerServiceFor(a.getClass().getCanonicalName(), a); SummonableService resolved = summoner.get(a.getClass().getCanonicalName(), a); summoner.interSummonResolve(true); assertEquals(a.getClass(), resolved.getClass()); }