1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.pool2;
18
19 import static org.junit.jupiter.api.Assertions.assertTrue;
20
21 import org.apache.commons.pool2.impl.DefaultPooledObject;
22 import org.junit.jupiter.api.Test;
23
24
25
26 public class TestBaseKeyedPooledObjectFactory {
27
28 private static class TestFactory extends BaseKeyedPooledObjectFactory<Object, Object> {
29 @Override
30 public Object create(final Object key) {
31 return null;
32 }
33 @Override
34 public PooledObject<Object> wrap(final Object value) {
35 return new DefaultPooledObject<>(value);
36 }
37 }
38
39 @Test
40 public void testDefaultMethods() throws Exception {
41 final KeyedPooledObjectFactory<Object, Object> factory = new TestFactory();
42
43 factory.activateObject("key", null);
44 factory.passivateObject("key", null);
45 factory.destroyObject("key", null);
46 assertTrue(factory.validateObject("key", null));
47 }
48 }