Source:
public void testDefaultSettings() { ConfigurableApplicationContext applicationContext = SpringApplication.run(TestFooChannels.class, "--spring.cloud.stream.bindings.foo.destination=fooDest", "--spring.cloud.stream.bindings.bar.destination=barDest", "--spring.cloud.stream.bindings.baz.destination=bazDest", "--spring.cloud.stream.bindings.qux.destination=quxDest", "--spring.cloud.stream.bindings.foo.group=fooBarGroup", "--spring.cloud.stream.bindings.bar.group=fooBarGroup", "--spring.cloud.stream.consumerDefaults.concurrency=2", "--spring.cloud.stream.producerDefaults.requiredGroups=quxbazReq1,quxbazReq2"); Binder binder = applicationContext.getBean(Binder.class); FooChannels fooChannels = applicationContext.getBean(FooChannels.class); ArgumentCaptor<ConsumerProperties> fooConsumerProperties = ArgumentCaptor.forClass(ConsumerProperties.class); verify(binder).bindConsumer(eq("fooDest"), eq("fooBarGroup"), same(fooChannels.foo()), fooConsumerProperties.capture()); assertThat(fooConsumerProperties.getValue().getConcurrency(), CoreMatchers.equalTo(2)); ArgumentCaptor<ConsumerProperties> barConsumerProperties = ArgumentCaptor.forClass(ConsumerProperties.class); verify(binder).bindConsumer(eq("barDest"), eq("fooBarGroup"), same(fooChannels.bar()), barConsumerProperties.capture()); assertThat(barConsumerProperties.getValue().getConcurrency(), CoreMatchers.equalTo(2)); ArgumentCaptor<ProducerProperties> bazProducerProperties = ArgumentCaptor.forClass(ProducerProperties.class); verify(binder).bindProducer(eq("bazDest"), same(fooChannels.baz()), bazProducerProperties.capture()); assertThat(bazProducerProperties.getValue().getRequiredGroups(), arrayContaining("quxbazReq1", "quxbazReq2")); ArgumentCaptor<ProducerProperties> quxProducerProperties = ArgumentCaptor.forClass(ProducerProperties.class); verify(binder).bindProducer(eq("quxDest"), same(fooChannels.qux()), quxProducerProperties.capture()); assertThat(quxProducerProperties.getValue().getRequiredGroups(), arrayContaining("quxbazReq1", "quxbazReq2")); verifyNoMoreInteractions(binder); applicationContext.close(); }

Target:
public void testDefaultSettings() { ConfigurableApplicationContext applicationContext = createBuilder().run( "--spring.cloud.stream.bindings.foo.destination=fooDest", "--spring.cloud.stream.bindings.bar.destination=barDest", "--spring.cloud.stream.bindings.baz.destination=bazDest", "--spring.cloud.stream.bindings.qux.destination=quxDest", "--spring.cloud.stream.bindings.foo.group=fooBarGroup", "--spring.cloud.stream.bindings.bar.group=fooBarGroup", "--spring.cloud.stream.consumerDefaults.concurrency=2", "--spring.cloud.stream.producerDefaults.requiredGroups=quxbazReq1,quxbazReq2"); Binder binder = applicationContext.getBean(Binder.class); FooChannels fooChannels = applicationContext.getBean(FooChannels.class); ArgumentCaptor<ConsumerProperties> fooConsumerProperties = ArgumentCaptor.forClass(ConsumerProperties.class); verify(binder).bindConsumer(eq("fooDest"), eq("fooBarGroup"), same(fooChannels.foo()), fooConsumerProperties.capture()); assertThat(fooConsumerProperties.getValue().getConcurrency(), CoreMatchers.equalTo(2)); ArgumentCaptor<ConsumerProperties> barConsumerProperties = ArgumentCaptor.forClass(ConsumerProperties.class); verify(binder).bindConsumer(eq("barDest"), eq("fooBarGroup"), same(fooChannels.bar()), barConsumerProperties.capture()); assertThat(barConsumerProperties.getValue().getConcurrency(), CoreMatchers.equalTo(2)); ArgumentCaptor<ProducerProperties> bazProducerProperties = ArgumentCaptor.forClass(ProducerProperties.class); verify(binder).bindProducer(eq("bazDest"), same(fooChannels.baz()), bazProducerProperties.capture()); assertThat(bazProducerProperties.getValue().getRequiredGroups(), arrayContaining("quxbazReq1", "quxbazReq2")); ArgumentCaptor<ProducerProperties> quxProducerProperties = ArgumentCaptor.forClass(ProducerProperties.class); verify(binder).bindProducer(eq("quxDest"), same(fooChannels.qux()), quxProducerProperties.capture()); assertThat(quxProducerProperties.getValue().getRequiredGroups(), arrayContaining("quxbazReq1", "quxbazReq2")); verifyNoMoreInteractions(binder); applicationContext.close(); }