FluxMessageChannel.send: no subscribers assertion

This commit is contained in:
Artem Bilan
2017-06-21 11:10:41 -04:00
parent ecb7d03895
commit a834ce9ffb
2 changed files with 15 additions and 0 deletions

View File

@@ -16,6 +16,7 @@
package org.springframework.integration.channel.reactive;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertSame;
@@ -259,4 +260,16 @@ public class ReactiveStreamsConsumerTests {
assertThat(result, Matchers.<Message<?>>contains(testMessage, testMessage2, testMessage2));
}
@Test
public void testFluxMessageChannelSendWithoutSubscription() {
try {
new FluxMessageChannel().send(new GenericMessage<>("foo"));
}
catch (Exception e) {
assertThat(e, instanceOf(MessageDeliveryException.class));
assertThat(e.getCause(), instanceOf(IllegalStateException.class));
assertThat(e.getMessage(), containsString("doesn't have subscribers to accept messages"));
}
}
}