Commit 8a74acbe by danarapagna Committed by Oliver Woodman

Automated g4 rollback of changelist 191128111.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191834511
parent 26cb32ab
......@@ -93,6 +93,10 @@ public final class SimpleCache implements Cache {
* @param index The CachedContentIndex to be used.
*/
/*package*/ SimpleCache(File cacheDir, CacheEvictor evictor, CachedContentIndex index) {
if (!lockFolder(cacheDir)) {
throw new IllegalStateException("Another SimpleCache instance uses the folder: " + cacheDir);
}
this.cacheDir = cacheDir;
this.evictor = evictor;
this.index = index;
......
......@@ -296,17 +296,17 @@ public class SimpleCacheTest {
}
}
// @Test
// public void testMultipleSimpleCacheWithSameCacheDirThrowsException() throws Exception {
// new SimpleCache(cacheDir, new NoOpCacheEvictor());
//
// try {
// new SimpleCache(cacheDir, new NoOpCacheEvictor());
// assertWithMessage("Exception was expected").fail();
// } catch (IllegalStateException e) {
// // Expected. Do nothing.
// }
// }
@Test
public void testMultipleSimpleCacheWithSameCacheDirThrowsException() throws Exception {
new SimpleCache(cacheDir, new NoOpCacheEvictor());
try {
new SimpleCache(cacheDir, new NoOpCacheEvictor());
assertWithMessage("Exception was expected").fail();
} catch (IllegalStateException e) {
// Expected. Do nothing.
}
}
@Test
public void testMultipleSimpleCacheWithSameCacheDirDoesNotThrowsExceptionAfterRelease()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment