@Test
public void testLifeCycleMethods()
throws Exception
{
InvocationTestMP prototype = new InvocationTestMP();
LifecycleHelper invoker = new LifecycleHelper(prototype);
InvocationTestMP instance = (InvocationTestMP)invoker.newInstance();
assertNotNull("instantiation failed; null instance", instance);
assertNotSame("instantiation failed; returned prototype", prototype, instance);
assertFalse("instance activated before activation method called", instance.isActivated);
assertTrue(invoker.activate(instance, null, "ABC".getBytes()));
assertTrue("instance was not activated", instance.isActivated);
assertEquals("ABC", instance.activationValue);
assertFalse("instance passivated before passivation method called", instance.isPassivated);
byte[] data = invoker.passivate(instance);
assertTrue("instance was not passivated", instance.isPassivated);
assertEquals("ABC", new String(data));
}