Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save butzopower/4cd99c0c720ffac9689004424402d2d0 to your computer and use it in GitHub Desktop.
Save butzopower/4cd99c0c720ffac9689004424402d2d0 to your computer and use it in GitHub Desktop.
// example application.properties
// spring.cloud.stream.bindings.input.destination=unenriched
// spring.cloud.stream.bindings.input.group=default
// spring.cloud.stream.bindings.output.destination=enriched
// spring.cloud.stream.bindings.output.group=default
// spring.cloud.stream.bindings.output.content-type=application/json
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = com.example.EnricherApplication.class)
@IntegrationTest()
public class EnricherTest {
@Autowired
TestMessageBroker testMessageBroker;
@Before
public void setUp() throws Exception {
testMessageBroker.purgeAll();
}
@Test
public void messageGetsEnrichedWithMyCoolField() throws Exception {
testMessageBroker.forTopic("unenriched.default").send("{\"foo\":\"bar\"}");
String result = testMessageBroker.forTopic("enriched.default").poll();
assertEquals(result, "{\"foo\":\"bar\",\"myCoolField\":12345}");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment