}
@Test
public void testConcurrency2() throws InterruptedException, IOException {
final Storage sM = createStorage();
final StorageLayer storageGeneric = new StorageLayer(sM);
store(storageGeneric);
final AtomicInteger counter = new AtomicInteger();
for (int i = 0; i < 100; i++) {
new Thread(new Runnable() {
@Override
public void run() {
Data result1 = null;
Data result2 = null;
Data result3 = null;
try {
result1 = storageGeneric.get(key1);
Assert.assertEquals("test1", result1.object());
result3 = storageGeneric.get(key3);
Assert.assertEquals(null, result3);
store(storageGeneric, 1);
} catch (Throwable t) {
t.printStackTrace();
counter.incrementAndGet();
}
try {
result2 = storageGeneric.get(key2);
Assert.assertEquals("test2", result2.object());
result3 = storageGeneric.get(key3);
Assert.assertEquals(null, result3);
store(storageGeneric, 1);
} catch (Throwable t) {
t.printStackTrace();
counter.incrementAndGet();