close cache instances properly

This commit is contained in:
Ahmed Tawila 2017-09-16 17:43:16 +02:00
parent 4647e1b10e
commit 58aae2a09d
3 changed files with 18 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import javax.cache.configuration.FactoryBuilder;
import javax.cache.configuration.MutableConfiguration;
import javax.cache.spi.CachingProvider;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -32,4 +33,9 @@ public class CacheLoaderTest {
assertEquals("fromCache" + i, value);
}
}
@After
public void closeCache() {
cache.close();
}
}

View File

@ -8,6 +8,7 @@ import javax.cache.Caching;
import javax.cache.configuration.MutableConfiguration;
import javax.cache.spi.CachingProvider;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -29,4 +30,9 @@ public class EntryProcessorTest {
this.cache.invoke("key", new SimpleEntryProcessor());
assertEquals("value - modified", cache.get("key"));
}
@After
public void closeCache() {
cache.close();
}
}

View File

@ -10,6 +10,7 @@ import javax.cache.configuration.MutableCacheEntryListenerConfiguration;
import javax.cache.configuration.MutableConfiguration;
import javax.cache.spi.CachingProvider;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -43,4 +44,9 @@ public class EventListenerTest {
assertEquals(true, this.listener.getUpdated());
}
@After
public void closeCache() {
cache.close();
}
}