InMemoryConnector implements IncomingConnectorFactory, OutgoingConnectorFactory { public <T> InMemorySink<T> sink(String channel) { if (channel == null) { throw ex.illegalArgumentChannelMustNotBeNull(); } InMemorySink<?> sink = sinks.get(channel); if (sink == null) { throw ex.illegalArgumentUnknownChannel(channel); } return (InMemorySink<T>) sink; }  static Map<String, String> switchIncomingChannelsToInMemory(String... channels); static Map<String, String> switchOutgoingChannelsToInMemory(String... channels); static void clear(); @Override PublisherBuilder<? extends Message<?>> getPublisherBuilder(Config config); @Override SubscriberBuilder<? extends Message<?>, Void> getSubscriberBuilder(Config config); InMemorySource<T> source(String channel); InMemorySink<T> sink(String channel); static final String CONNECTOR; }
@Test(expected = IllegalArgumentException.class) public void testWithUnknownSink() { addBeanClass(MyBeanReceivingString.class); initialize(); InMemoryConnector bean = container.getBeanManager().createInstance() .select(InMemoryConnector.class, ConnectorLiteral.of(InMemoryConnector.CONNECTOR)).get(); assertThat(bean).isNotNull(); bean.sink("unknown"); }