01: package net.sourceforge.jaxor.util.tests;
02:
03: import junit.framework.TestCase;
04: import net.sourceforge.jaxor.example.db.HyperConnection;
05: import net.sourceforge.jaxor.util.DynamicDecorator;
06:
07: import java.sql.Connection;
08: import java.sql.SQLException;
09:
10: /*
11: * User: Mike
12: * Date: Nov 10, 2002
13: * Time: 12:36:16 PM
14: */
15:
16: public class DynamicDecoratorTest extends TestCase {
17: Connection conn;
18:
19: protected void setUp() throws Exception {
20: conn = HyperConnection.INSTANCE.getConnection();
21: }
22:
23: protected void tearDown() throws Exception {
24: conn.close();
25: }
26:
27: public void testOverride() throws SQLException {
28: DynamicDecorator.Override[] override = new DynamicDecorator.Override[] { new DynamicDecorator.Override(
29: "close", new Class[0]) };
30: Connection connection = (Connection) DynamicDecorator.create(
31: conn, override);
32: connection.close();
33: assertFalse(conn.isClosed());
34: conn.close();
35: assertTrue(conn.isClosed());
36: }
37: }
|