Pull request changes done

This commit is contained in:
Jose Carvajal 2017-10-11 12:11:38 +02:00
parent 57a993de64
commit e8979a4033
5 changed files with 70 additions and 75 deletions

View File

@ -17,7 +17,6 @@
</parent> </parent>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId> <artifactId>spring-cloud-starter-stream-rabbit</artifactId>

View File

@ -26,13 +26,13 @@ public class MultipleOutputsServiceApplicationTests {
private MessageCollector messageCollector; private MessageCollector messageCollector;
@Test @Test
public void shouldReceiveMessageInAnOutput() { public void whenSendMessage_thenResponseIsInAOutput() {
whenSendMessage(1); whenSendMessage(1);
thenPayloadInChannelIs(pipe.anOutput(), 1); thenPayloadInChannelIs(pipe.anOutput(), 1);
} }
@Test @Test
public void shouldReceiveMessageInAnAnotherOutput() { public void whenSendMessage_thenResponseIsInAnotherOutput() {
whenSendMessage(11); whenSendMessage(11);
thenPayloadInChannelIs(pipe.anotherOutput(), 11); thenPayloadInChannelIs(pipe.anotherOutput(), 11);
} }

View File

@ -26,13 +26,13 @@ public class MultipleOutputsWithConditionsServiceApplicationTests {
private MessageCollector messageCollector; private MessageCollector messageCollector;
@Test @Test
public void shouldReceiveMessageInAnOutput() { public void whenSendMessage_thenResponseIsInAOutput() {
whenSendMessage(1); whenSendMessage(1);
thenPayloadInChannelIs(pipe.anotherOutput(), 1); thenPayloadInChannelIs(pipe.anotherOutput(), 1);
} }
@Test @Test
public void shouldReceiveMessageInAnAnotherOutput() { public void whenSendMessage_thenResponseIsInAnotherOutput() {
whenSendMessage(11); whenSendMessage(11);
thenPayloadInChannelIs(pipe.anotherOutput(), 11); thenPayloadInChannelIs(pipe.anotherOutput(), 11);
} }

View File

@ -12,7 +12,6 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.baeldung.spring.cloud.stream.rabbit.MyLoggerServiceApplication;
import com.baeldung.spring.cloud.stream.rabbit.model.LogMessage; import com.baeldung.spring.cloud.stream.rabbit.model.LogMessage;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ -27,18 +26,15 @@ public class MyLoggerApplicationTests {
private MessageCollector messageCollector; private MessageCollector messageCollector;
@Test @Test
public void shouldEnrichMessage() { public void whenSendMessage_thenResponseShouldUpdateText() {
// Send message
pipe.input() pipe.input()
.send(MessageBuilder.withPayload(new LogMessage("This is my message")) .send(MessageBuilder.withPayload(new LogMessage("This is my message"))
.build()); .build());
// Get response from the service
Object payload = messageCollector.forChannel(pipe.output()) Object payload = messageCollector.forChannel(pipe.output())
.poll() .poll()
.getPayload(); .getPayload();
// Assert
assertEquals("[1]: This is my message", payload.toString()); assertEquals("[1]: This is my message", payload.toString());
} }
} }