Search in sources :

Example 1 with Message

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

the class MessageProcessMessageHandlingTest method testMpMessageTypeInfoOnParameter.

@Test
public void testMpMessageTypeInfoOnParameter() throws Exception {
    final MessageProcessor<TestMpWithMultiLevelMessageTypeParameter> helper = new MessageProcessor<TestMpWithMultiLevelMessageTypeParameter>(new TestMpWithMultiLevelMessageTypeParameter());
    helper.validate();
    final Set<String> mts = helper.messagesTypesHandled();
    assertEquals(1, mts.size());
    exception.expect(IllegalArgumentException.class);
    exception.expectMessage("no handler for messages of type");
    final Message m = new Message("yo");
    final TestMpWithMultiLevelMessageTypeParameter instance = helper.newInstance();
    helper.invoke(instance, km(m));
}
Also used : TestMpWithMultiLevelMessageTypeParameter(net.dempsy.lifecycle.annotations.TestMps.TestMpWithMultiLevelMessageTypeParameter) Message(net.dempsy.lifecycle.annotations.TestMps.Message) MessageProcessor(net.dempsy.lifecycle.annotation.MessageProcessor) Test(org.junit.Test)

Example 2 with Message

use of net.dempsy.lifecycle.annotations.TestMps.Message 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 3 with Message

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

the class MessageProcessMessageHandlingTest method testMpMessageTypeInfoOnReturn.

@Test
public void testMpMessageTypeInfoOnReturn() throws Exception {
    final MessageProcessor<TestMpWithReturn> helper = new MessageProcessor<TestMpWithReturn>(new TestMpWithReturn());
    helper.validate();
    final Message m = new Message("yo");
    final TestMpWithReturn instance = helper.newInstance();
    final List<KeyedMessageWithType> kms = helper.invoke(instance, km(m));
    assertEquals(1, kms.size());
    assertNotNull(kms.get(0).messageTypes);
    assertEquals(1, kms.get(0).messageTypes.length);
}
Also used : KeyedMessageWithType(net.dempsy.messages.KeyedMessageWithType) Message(net.dempsy.lifecycle.annotations.TestMps.Message) MessageProcessor(net.dempsy.lifecycle.annotation.MessageProcessor) TestMpWithReturn(net.dempsy.lifecycle.annotations.TestMps.TestMpWithReturn) Test(org.junit.Test)

Aggregations

MessageProcessor (net.dempsy.lifecycle.annotation.MessageProcessor)3 Message (net.dempsy.lifecycle.annotations.TestMps.Message)3 Test (org.junit.Test)3 TestMp (net.dempsy.lifecycle.annotations.TestMps.TestMp)1 TestMpWithMultiLevelMessageTypeParameter (net.dempsy.lifecycle.annotations.TestMps.TestMpWithMultiLevelMessageTypeParameter)1 TestMpWithReturn (net.dempsy.lifecycle.annotations.TestMps.TestMpWithReturn)1 KeyedMessageWithType (net.dempsy.messages.KeyedMessageWithType)1