switched from accessing field to an accessor method for access in tests.

Strangely, this fixes the broken tests in the continuous build.
This commit is contained in:
Inderjeet Singh 2011-03-31 18:57:55 +00:00
parent 5bc80cd693
commit 9c894c7485
2 changed files with 8 additions and 4 deletions

View File

@ -24,11 +24,10 @@ import java.lang.reflect.Constructor;
*
* @author Joel Leitch
*/
class DefaultConstructorAllocator {
final class DefaultConstructorAllocator {
private static final Constructor<Null> NULL_CONSTRUCTOR = createNullConstructor();
// Package private for testing purposes.
final Cache<Class<?>, Constructor<?>> constructorCache;
private final Cache<Class<?>, Constructor<?>> constructorCache;
public DefaultConstructorAllocator() {
this(200);
@ -38,6 +37,11 @@ class DefaultConstructorAllocator {
constructorCache = new LruCache<Class<?>, Constructor<?>>(cacheSize);
}
// for testing purpose
final Cache<Class<?>, Constructor<?>> getConstructorCache() {
return constructorCache;
}
private static final Constructor<Null> createNullConstructor() {
try {
return getNoArgsConstructor(Null.class);

View File

@ -54,7 +54,7 @@ public class DefaultConstructorAllocatorTest extends TestCase {
}
private void assertInCache(Class<?> clazz) {
assertNotNull(allocator.constructorCache.getElement(clazz));
assertNotNull(allocator.getConstructorCache().getElement(clazz));
}
private static class NoDefaultConstructor {