public void testConfigure_CustomInitializeMissing() throws Exception { JavaActor actor = new JavaActor(); actor.setName("MultiplyActor"); MultiplyBean bean = new MultiplyBean(); actor.setWrappedBean(bean); actor.setInitializeMethod("customInitializeMissing"); actor.setApplicationContext(_context); actor.afterPropertiesSet(); actor.elaborate(); Exception exception = null; try { actor.configure(); } catch (ActorDeclarationException e) { exception = e; } assertNotNull(exception); assertEquals( "org.restflow.exceptions.ActorDeclarationException: " + "Error finding declared method customInitializeMissing " + "on bean class org.restflow.actors.TestJavaActor$MultiplyBean " + "for actor MultiplyActor", exception.toString()); Throwable cause = exception.getCause(); assertNotNull(cause); assertEquals( "java.lang.NoSuchMethodException: " + "org.restflow.actors.TestJavaActor$MultiplyBean.customInitializeMissing()", cause.toString()); }
public void testConfigure_CustomInitialize() throws Exception { JavaActor actor = new JavaActor(); actor.setName("MultiplyActor"); MultiplyBean bean = new MultiplyBean(); actor.setWrappedBean(bean); actor.setInitializeMethod("customInitialize"); actor.setApplicationContext(_context); actor.afterPropertiesSet(); actor.elaborate(); actor.configure(); assertFalse(bean.initialized); actor.initialize(); assertTrue(bean.initialized); assertTrue(bean.customInitialization); }