-
Here's some sample code that I use to ensure the ObjectExistsException isn't thrown:
if (!cacheManager.cacheExists(cacheName)) {
synchronized (lock) {
if (!cacheManager.cacheExists(cacheName)) {
Ehcache ehcache = ...;
cacheManager.addCache(ehcache);
}
}
}
With the method I've proposed, my code would instead be:
if...
2009-07-10 16:22:10 UTC in ehcache
-
DESCRIPTION: I'm using the CacheManager#addCache(Ehcache) method to programatically add caches at runtime. The private CacheManager#addCacheNoCheck(Ehcache) throws an ObjectExistsException exception if the cache already exists. To avoid that exception, I need to synchronize my code which creates/adds a cache.
REQUEST: please consider creating an addCacheIfAbsent(Ehcache) method. Clients would...
2009-07-08 19:41:40 UTC in ehcache
-
two lame ideas to know when the 'current test' has changed:
a) create an EasyMock super class that implements an @After or tearDown(). The problem here is we'd need multiple super classes, one for JUnit 4, one for JUnit 3, one for TestNG, etc.
b) assume the 'current test' changes after a call to verifyAll(). The problem here is that users wouldn't be able to call verifyAll() twice in the same...
2009-04-13 15:58:15 UTC in EasyMock
-
great! Thanks!!
2008-12-01 15:18:34 UTC in moreUnit
-
Window -> Preferences -> General -> Editors -> Text Editors -> Annotatins
the above path does not have a "moreUnit testmethod" item, which would allow users to disable the marker
Why would we want to disable the marker?
In JUnit 4, with @Test annotations, we don't need to follow the JUnit3 naming pattern. Often (for example, when writing several tests for a particular method), my test...
2008-10-13 19:50:35 UTC in moreUnit
-
Renaming a package in the src/ folder doesn't cause the corresponding package in the test/ folder to be renamed.
In the following heirarchy
src/
edu/
lsu/
Main.java
test/
edu/
lsu/
MainTest.java
renaming the edu.lsu package to edu.lsux results in the following
src/
edu/
lsux/
Main.java
test/
edu/
lsu/.
2008-10-13 18:30:12 UTC in moreUnit
-
It would be great to have some convenience methods on the EasyMock class, like these two:
EasyMock.replayAll()
EasyMock.verifyAll()
They would specifically take no parameters, and be the equivalent of calling EasyMock.replay(...) for each mock that has been created in the current test.
2008-10-10 16:53:05 UTC in EasyMock