### Question:
InfinispanRemoteCacheManagerFactoryBean extends AbstractRemoteCacheManagerFactory implements FactoryBean<RemoteCacheManager>, InitializingBean, DisposableBean { @Override public void afterPropertiesSet() throws Exception { assertCorrectlyConfigured(); this.logger.info("Creating new instance of RemoteCacheManager ..."); final Properties configurationPropertiesToUse = configurationProperties(); org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = new org.infinispan.client.hotrod.configuration.ConfigurationBuilder(); clientBuilder.withProperties(configurationPropertiesToUse); this.nativeRemoteCacheManager = new RemoteCacheManager(clientBuilder.build(), this.startAutomatically); this.logger.info("Finished creating new instance of RemoteCacheManager"); }  @Override void afterPropertiesSet(); @Override RemoteCacheManager getObject(); @Override Class<? extends RemoteCacheManager> getObjectType(); @Override boolean isSingleton(); @Override void destroy();  }### Answer:
@Test(expectedExceptions = IllegalStateException.class) public final void shouldThrowAnIllegalStateExceptionIfBothConfigurationPropertiesAndConfigurationPropertiesFileLocationAreSet() throws Exception { final InfinispanRemoteCacheManagerFactoryBean objectUnderTest = new InfinispanRemoteCacheManagerFactoryBean(); objectUnderTest.setConfigurationProperties(new Properties()); objectUnderTest.setConfigurationPropertiesFileLocation(new ClassPathResource("dummy", getClass())); objectUnderTest.afterPropertiesSet(); }
@Test(expectedExceptions = IllegalStateException.class) public final void shouldThrowAnIllegalStateExceptionIfConfigurationPropertiesAsWellAsSettersAreUsedToConfigureTheRemoteCacheManager() throws Exception { final InfinispanRemoteCacheManagerFactoryBean objectUnderTest = new InfinispanRemoteCacheManagerFactoryBean(); objectUnderTest.setConfigurationProperties(new Properties()); objectUnderTest.setMarshaller("test.Marshaller"); objectUnderTest.afterPropertiesSet(); }