JGroupsChannelFactoryBean extends AbstractFactoryBean<JChannel> { public void setProtocolStackConfigurator(ProtocolStackConfigurator protocolStackConfigurator) { this.protocolStackConfigurator = protocolStackConfigurator; }  @Override JChannel createInstance(); @Override Class<?> getObjectType(); void setProtocolStackConfigurator(ProtocolStackConfigurator protocolStackConfigurator); void setClusterName(String clusterName);  }
@Test public void should_throw_exception_when_cluster_name_is_null() throws Exception { JGroupsChannelFactoryBean factoryBean = new JGroupsChannelFactoryBean(); factoryBean.setProtocolStackConfigurator(mock(ProtocolStackConfigurator.class)); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage(is("JGroups cluster name is null or empty")); factoryBean.afterPropertiesSet(); @SuppressWarnings("unused") JChannel channel = factoryBean.getObject(); }