01: package net.sourceforge.squirrel_sql.client.session.mainpanel;
02:
03: /*
04: * Copyright (C) 2007 Rob Manning
05: * manningr@users.sourceforge.net
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this library; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: */
21: import static org.easymock.EasyMock.createMock;
22:
23: import java.awt.Component;
24:
25: import net.sourceforge.squirrel_sql.BaseSQuirreLTestCase;
26: import net.sourceforge.squirrel_sql.client.session.ISession;
27:
28: public class BaseMainPanelTabTest extends BaseSQuirreLTestCase {
29:
30: protected void setUp() throws Exception {
31: }
32:
33: protected void tearDown() throws Exception {
34: }
35:
36: // Test to ensure that we allow sessions that are ending to be GC'd.
37: public void testSessionCleanup() {
38: MyBaseMainPanelTab tab = new MyBaseMainPanelTab();
39: ISession session1 = createMock(ISession.class);
40: tab.setSession(session1);
41: ISession session2 = createMock(ISession.class);
42: tab.sessionEnding(session2);
43: assertEquals(session1, tab.getSession());
44: tab.sessionEnding(session1);
45: assertEquals(null, tab.getSession());
46: }
47:
48: private class MyBaseMainPanelTab extends BaseMainPanelTab {
49:
50: /* (non-Javadoc)
51: * @see net.sourceforge.squirrel_sql.client.session.mainpanel.BaseMainPanelTab#refreshComponent()
52: */
53: @Override
54: protected void refreshComponent() {
55:
56: }
57:
58: /* (non-Javadoc)
59: * @see net.sourceforge.squirrel_sql.client.session.mainpanel.IMainPanelTab#getComponent()
60: */
61: public Component getComponent() {
62: return null;
63: }
64:
65: /* (non-Javadoc)
66: * @see net.sourceforge.squirrel_sql.client.session.mainpanel.IMainPanelTab#getHint()
67: */
68: public String getHint() {
69: return null;
70: }
71:
72: /* (non-Javadoc)
73: * @see net.sourceforge.squirrel_sql.client.session.mainpanel.IMainPanelTab#getTitle()
74: */
75: public String getTitle() {
76: return null;
77: }
78:
79: }
80: }
|