Skip to content

Commit

Permalink
Closing 91. Tests for IllegalStateException on getCacheNames when Cac…
Browse files Browse the repository at this point in the history
…heManager closed.
  • Loading branch information
gregrluck committed May 15, 2016
1 parent 6ed24d0 commit bc59f8d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bc59f8d

Please sign in to comment.