Search in sources :

Example 1 with TestMp

use of net.dempsy.lifecycle.annotations.TestMps.TestMp in project Dempsy by Dempsy.

the class MessageProcessMessageHandlingTest method testMessageTypeResolution.

@Test
public void testMessageTypeResolution() throws Exception {
    final MessageProcessor<TestMp> helper = new MessageProcessor<TestMp>(new TestMp());
    helper.validate();
    final Message m = new Message("yo");
    final TestMp instance = helper.newInstance();
    helper.invoke(instance, km(m));
}
Also used : Message(net.dempsy.lifecycle.annotations.TestMps.Message) MessageProcessor(net.dempsy.lifecycle.annotation.MessageProcessor) TestMp(net.dempsy.lifecycle.annotations.TestMps.TestMp) Test(org.junit.Test)

Example 2 with TestMp

use of net.dempsy.lifecycle.annotations.TestMps.TestMp in project Dempsy by Dempsy.

the class MessageProcessorTest method testMethodHandleWithParameters.

@Test
public void testMethodHandleWithParameters() throws Throwable {
    final MessageProcessor<TestMp> helper = new MessageProcessor<TestMp>(new TestMp());
    helper.validate();
    final TestMp mp = helper.newInstance();
    assertFalse(mp.activated);
    helper.activate(mp, "activate", new Object());
    assertTrue(mp.activated);
    assertFalse(mp.passivateCalled);
    helper.passivate(mp);
    assertTrue(mp.passivateCalled);
}
Also used : MessageProcessor(net.dempsy.lifecycle.annotation.MessageProcessor) TestMp(net.dempsy.lifecycle.annotations.TestMps.TestMp) Test(org.junit.Test)

Aggregations

MessageProcessor (net.dempsy.lifecycle.annotation.MessageProcessor)2 TestMp (net.dempsy.lifecycle.annotations.TestMps.TestMp)2 Test (org.junit.Test)2 Message (net.dempsy.lifecycle.annotations.TestMps.Message)1