diff --git a/cache-tests/src/test/java/org/jsr107/tck/CacheManagerTest.java b/cache-tests/src/test/java/org/jsr107/tck/CacheManagerTest.java index 8cb8cba..8ea934c 100644 --- a/cache-tests/src/test/java/org/jsr107/tck/CacheManagerTest.java +++ b/cache-tests/src/test/java/org/jsr107/tck/CacheManagerTest.java @@ -386,7 +386,12 @@ public void close_cachesEmpty() { cacheManager.createCache("c2", new MutableConfiguration()); cacheManager.close(); - assertFalse(cacheManager.getCacheNames().iterator().hasNext()); + try { + cacheManager.getCacheNames(); + fail(); + } catch (IllegalStateException e) { + //expected + } } @Test diff --git a/cache-tests/src/test/java/org/jsr107/tck/management/CacheManagerManagementTest.java b/cache-tests/src/test/java/org/jsr107/tck/management/CacheManagerManagementTest.java index 04bb405..f42dfe4 100644 --- a/cache-tests/src/test/java/org/jsr107/tck/management/CacheManagerManagementTest.java +++ b/cache-tests/src/test/java/org/jsr107/tck/management/CacheManagerManagementTest.java @@ -123,8 +123,10 @@ public void setUp() throws Exception { @After public void tearDown() throws MalformedObjectNameException { //assertEquals(0, mBeanServer.queryNames(new ObjectName("java.cache:*"), null).size()); - for (String cacheName : cacheManager.getCacheNames()) { - cacheManager.destroyCache(cacheName); + if (!cacheManager.isClosed()) { + for (String cacheName : cacheManager.getCacheNames()) { + cacheManager.destroyCache(cacheName); + } } cacheManager.close(); //All registered object names should be removed during shutdown