@Test public void shouldMapReceiveAttributes() throws JMSException { // Given Mapping mapping = MessageSender.getJmsMappingFor(MappedApi.class); MapMessage message = createPayload(OPERATION_FIELD_NAME, "mappedCall", "A", "value1", "B", 0L); // When receive(message, mapping); // Then verify(serviceMock).mappedCall("value1", 0L); }
@Test public void shouldMapSendAttributes() throws JMSException { // Given MappedApi proxy = MessageSender.of(MappedApi.class); // When proxy.mappedCall("a", 0L); // Then MapMessage message = (MapMessage) captureMessage(); assertEquals("a", message.getObject("A")); assertEquals("0", message.getObject("B")); }
@Test public void shouldCallServiceWhenSendingAsMapMessage() { // Given MappedApi sendProxy = MessageSender.of(MappedApi.class); Mapping receiveMapping = new MappingBuilder(OPERATION_FIELD_NAME) // .mapField("s1", FieldMapping.map("A")) // .mapField("s2", FieldMapping.map("B")) // .build(); // When sendProxy.mappedCall("a", 0L); receive(captureMessage(), receiveMapping); // Then verify(serviceMock).mappedCall("a", 0L); }