### Question:
NaturalIdMemcachedRegion extends TransactionalDataMemcachedRegion implements NaturalIdRegion { @Override public NaturalIdRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { switch (accessType) { case READ_ONLY: return new ReadOnlyNaturalIdRegionAccessStrategy(this); case NONSTRICT_READ_WRITE: return new NonstrictReadWriteNaturalIdRegionAccessStrategy(this); default: throw new CacheException("Unsupported access strategy : " + accessType + "."); } } NaturalIdMemcachedRegion(String regionName, OverridableReadOnlyProperties properties,
                                    CacheDataDescription metadata, Settings settings,
                                    MemcachedAdapter memcachedAdapter,
                                    HibernateCacheTimestamper hibernateCacheTimestamper); @Override NaturalIdRegionAccessStrategy buildAccessStrategy(AccessType accessType);  }### Answer:
@Test public void buildAccessStrategy_AccessType_READ_ONLY() throws Exception { assertThat(naturalIdMemcachedRegion.buildAccessStrategy(AccessType.READ_ONLY)) .isExactlyInstanceOf(ReadOnlyNaturalIdRegionAccessStrategy.class); }
@Test public void buildAccessStrategy_AccessType_NONSTRICT_READ_WRITE() throws Exception { assertThat(naturalIdMemcachedRegion.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE)) .isExactlyInstanceOf(NonstrictReadWriteNaturalIdRegionAccessStrategy.class); }
@Test public void buildAccessStrategy_AccessType_READ_WRITE() throws Exception { expectedException.expect(CacheException.class); expectedException.expectMessage(containsString(AccessType.READ_WRITE.toString())); naturalIdMemcachedRegion.buildAccessStrategy(AccessType.READ_WRITE); }
@Test public void buildAccessStrategy_AccessType_TRANSACTIONAL() throws Exception { expectedException.expect(CacheException.class); expectedException.expectMessage(containsString(AccessType.TRANSACTIONAL.toString())); naturalIdMemcachedRegion.buildAccessStrategy(AccessType.TRANSACTIONAL); }