This commit is contained in:
Mark Fisher
2008-11-21 16:05:53 +00:00
parent 7b670760be
commit bbd58b830f
2 changed files with 28 additions and 4 deletions

View File

@@ -173,6 +173,25 @@ public class MethodInvokingTransformerTests {
assertEquals("baz", result.getHeaders().get("prop3"));
}
@Test
public void messageReturnValueConfiguredWithMethodReference() throws Exception {
TestBean testBean = new TestBean();
Method testMethod = testBean.getClass().getMethod("messageReturnValueTest", Message.class);
MethodInvokingTransformer transformer = new MethodInvokingTransformer(testBean, testMethod);
Message<String> message = MessageBuilder.withPayload("test").build();
Message<?> result = transformer.transform(message);
assertEquals("test", result.getPayload());
}
@Test
public void messageReturnValueConfiguredWithMethodName() throws Exception {
TestBean testBean = new TestBean();
MethodInvokingTransformer transformer = new MethodInvokingTransformer(testBean, "messageReturnValueTest");
Message<String> message = MessageBuilder.withPayload("test").build();
Message<?> result = transformer.transform(message);
assertEquals("test", result.getPayload());
}
@Test
@SuppressWarnings("unchecked")
public void propertiesPayloadConfiguredWithMethodReference() throws Exception {
@@ -246,6 +265,10 @@ public class MethodInvokingTransformerTests {
properties.setProperty("prop2", "bar");
return properties;
}
public Message<?> messageReturnValueTest(Message<?> message) {
return message;
}
}
}