1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.pool;
19
20 import junit.framework.TestCase;
21
22
23
24
25
26
27
28 public abstract class TestKeyedObjectPoolFactory extends TestCase {
29 protected TestKeyedObjectPoolFactory(final String name) {
30 super(name);
31 }
32
33
34
35
36 protected KeyedObjectPoolFactory makeFactory() throws UnsupportedOperationException {
37 return makeFactory(createObjectFactory());
38 }
39
40
41
42
43 protected abstract KeyedObjectPoolFactory makeFactory(KeyedPoolableObjectFactory objectFactory) throws UnsupportedOperationException;
44
45 protected static KeyedPoolableObjectFactory createObjectFactory() {
46 return PoolUtils.adapt(new MethodCallPoolableObjectFactory());
47 }
48
49 public void testCreatePool() throws Exception {
50 final KeyedObjectPoolFactory factory;
51 try {
52 factory = makeFactory();
53 } catch (UnsupportedOperationException uoe) {
54 return;
55 }
56 final KeyedObjectPool pool = factory.createPool();
57 pool.close();
58 }
59
60 public void testToString() {
61 final KeyedObjectPoolFactory factory;
62 try {
63 factory = makeFactory();
64 } catch (UnsupportedOperationException uoe) {
65 return;
66 }
67 factory.toString();
68 }
69 }