5354555657585960616263
ServiceDef serviceDef = moduleDef.getServiceDef(SpringModuleDef.SERVICE_ID); ObjectCreator serviceCreator = serviceDef.createServiceCreator(resources); assertSame(serviceCreator.createObject(), ac); verify(); // Now, let's test for some of the services.
5657585960616263646566
replay(); ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION, findMethod(fixture, "build_noargs")); Object actual = sc.createObject(); assertSame(actual, fixture.fie); verify(); }
99100101102103104105106107108109
replay(); ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION, method); Object actual = sc.createObject(); assertSame(actual, fixture.fie); verify(); }
135136137138139140141142143144145
165166167168169170171172173174175
replay(); ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION, findMethod(fixture, "build_injected")); Object actual = sc.createObject(); assertSame(actual, fixture.fie); verify(); }
197198199200201202203204205206207
replay(); ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION, findMethod(fixture, "buildWithOrderedConfiguration")); Object actual = sc.createObject(); assertSame(actual, fixture.fie); verify(); }
229230231232233234235236237238239
replay(); ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION, findMethod(fixture, "buildWithUnorderedConfiguration")); Object actual = sc.createObject(); assertSame(actual, fixture.fie); verify(); }
262263264265266267268269270271272
ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION, method); try { sc.createObject(); unreachable(); } catch (RuntimeException ex) { Assert.assertEquals(ex.getMessage(), "Builder method " + CREATOR_DESCRIPTION
295296297298299300301302303304305
ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION, method); try { sc.createObject(); unreachable(); } catch (RuntimeException ex) { assertEquals(ex.getMessage(), "Error invoking service builder method " + CREATOR_DESCRIPTION
335336337338339340341342343344345
replay(); ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION, method); Object actual = sc.createObject(); verify(); assertSame(actual, fixture.fie); }