124125126127128129130131132133134
{ Bean bean = new Bean(); ctx.putBean("bean", bean); SpringBeanLocator locator = new SpringBeanLocator("bean", Bean.class, ctxLocator); assertTrue(locator.locateProxyTarget() == bean); } /** * tests lookup by name after locator has been deserialized
139140141142143144145146147148149
ctx.putBean("bean", bean); SpringBeanLocator locator = (SpringBeanLocator) Objects .cloneObject(new SpringBeanLocator("bean", Bean.class, ctxLocator)); assertNotNull(locator.locateProxyTarget()); } /** * tests error if no bean with name found */
150151152153154155156157158159160
public void testLookupByNameNotFound() { SpringBeanLocator locator = new SpringBeanLocator("bean", Bean.class, ctxLocator); try { locator.locateProxyTarget(); fail(); } catch (IllegalStateException e) { // noop
194195196197198199200201202203204
{ SpringContextLocatorMock ctxLocator = new SpringContextLocatorMock(null); SpringBeanLocator locator = new SpringBeanLocator(Bean.class, ctxLocator); try { locator.locateProxyTarget(); } catch (IllegalStateException e) { // noop }