### Question:
Hibernate4MemcachedRegionFactory implements RegionFactory { MemcachedAdapter populateMemcachedProvider(OverridableReadOnlyProperties properties) { String adapterClass = properties.getRequiredProperty(MEMCACHED_ADAPTER_CLASS_PROPERTY_KEY); MemcachedAdapter adapter; try { Class<?> clazz = Class.forName(adapterClass); adapter = (MemcachedAdapter) clazz.newInstance(); } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } adapter.init(properties); return adapter; } Hibernate4MemcachedRegionFactory();  Hibernate4MemcachedRegionFactory(Properties properties); @Override void start(Settings settings, Properties properties); @Override void stop(); @Override boolean isMinimalPutsEnabledByDefault(); @Override AccessType getDefaultAccessType(); @Override long nextTimestamp(); @Override EntityRegion buildEntityRegion(String regionName, Properties properties,
                                          CacheDataDescription metadata); @Override NaturalIdRegion buildNaturalIdRegion(String regionName, Properties properties,
                                                CacheDataDescription metadata); @Override CollectionRegion buildCollectionRegion(String regionName, Properties properties,
                                                  CacheDataDescription metadata); @Override QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties); @Override TimestampsRegion buildTimestampsRegion(String regionName, Properties properties); static final int MEMCACHED_MAX_EPIRY_SECONDS; static final AccessType DEFAULT_ACCESS_TYPE; static final String REGION_EXPIRY_SECONDS_PROPERTY_KEY_PREFIX; static final String MEMCACHED_ADAPTER_CLASS_PROPERTY_KEY; static final String TIMESTAMPER_PROPERTY_KEY; static final Class<?> DEFAULT_TIMESTAMPER_CLASS; }### Answer:
@Test public void populateMemcachedProvider_no_property() throws Exception { expectedException.expect(IllegalStateException.class); expectedException.expectMessage(CoreMatchers.containsString(Hibernate4MemcachedRegionFactory .MEMCACHED_ADAPTER_CLASS_PROPERTY_KEY)); regionFactory.populateMemcachedProvider(new OverridableReadOnlyPropertiesImpl(new Properties())); }
@Test public void populateMemcachedProvider() throws Exception { Properties properties = new Properties(); properties.setProperty(Hibernate4MemcachedRegionFactory.MEMCACHED_ADAPTER_CLASS_PROPERTY_KEY, FakeMemcachedAdapter.class.getName()); MemcachedAdapter memcachedAdapter = regionFactory.populateMemcachedProvider(new OverridableReadOnlyPropertiesImpl(properties)); assertThat(memcachedAdapter).isNotNull().isInstanceOf(FakeMemcachedAdapter.class); assertThat(((FakeMemcachedAdapter) memcachedAdapter).isInitCalled()).isTrue(); }