@Test public void testSynchronizedPoolableFactoryKeyedPoolableObjectFactory() throws Exception { try { PoolUtils.synchronizedKeyedPooledFactory((KeyedPooledObjectFactory<Object,Object>)null); fail("PoolUtils.synchronizedPoolableFactory(KeyedPoolableObjectFactory) must not allow a null factory."); } catch(final IllegalArgumentException iae) { // expected } final List<String> calledMethods = new ArrayList<>(); @SuppressWarnings("unchecked") final KeyedPooledObjectFactory<Object,Object> kpof = createProxy(KeyedPooledObjectFactory.class, calledMethods); final KeyedPooledObjectFactory<Object,Object> skpof = PoolUtils.synchronizedKeyedPooledFactory(kpof); final List<String> expectedMethods = invokeEveryMethod(skpof); assertEquals(expectedMethods, calledMethods); // TODO: Anyone feel motivated to construct a test that verifies proper synchronization? }