Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src-test / com / iver / cit / gvsig / panelGroup / TestPanelGroupLoaderFromExtensionPoint.java @ 17026

History | View | Annotate | Download (2.58 KB)

1 15734 vcaballero
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
20
package com.iver.cit.gvsig.panelGroup;
21
22
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel;
23
24
import junit.framework.TestCase;
25
26
import com.iver.cit.gvsig.panelGroup.loaders.PanelGroupLoaderFromExtensionPoint;
27
import com.iver.cit.gvsig.panelGroup.samples.Sample_ExtensionPointsOfIPanels;
28
29
/**
30
 * <p>Tests {@link PanelGroupLoaderFromExtensionPoint PanelGroupLoaderFromExtensionPoint}.</p>
31
 *
32
 * @version 16/10/2007
33
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
34
 */
35
public class TestPanelGroupLoaderFromExtensionPoint extends TestCase {
36
37
        /*
38
         * (non-Javadoc)
39
         * @see junit.framework.TestCase#setUp()
40
         */
41
        protected void setUp() throws Exception {
42
                super.setUp();
43
        }
44
45
        /*
46
         * (non-Javadoc)
47
         * @see junit.framework.TestCase#tearDown()
48
         */
49
        protected void tearDown() throws Exception {
50
                super.tearDown();
51
        }
52
53
        /**
54
         * <p>Test, results must be valid.</p>
55
         */
56
        public void test() {
57
                System.out.println("==> BEGINNING TEST CLASS: \'\'PanelGroupLoaderFromExtensionPoint\'\' <==");
58
59
                try {
60
                        Sample_ExtensionPointsOfIPanels.loadSample();
61
62
                        PanelGroupLoaderFromExtensionPoint loader = new PanelGroupLoaderFromExtensionPoint(Sample_ExtensionPointsOfIPanels.EXTENSIONPOINT1_NAME);
63 17026 vcaballero
                        AbstractPanel[] panels = (AbstractPanel[]) loader.loadPanels();
64 15734 vcaballero
65
                        // Check that has loaded all panels
66
                        assertEquals(Sample_ExtensionPointsOfIPanels.EXTENSIONPOINTS1_CLASSES.length, panels.length);
67
68
                        int i = 0;
69
70
                        for (AbstractPanel panel: panels) {
71
                                // Check order and class types
72
                                assertTrue(panel.getClass() == (Sample_ExtensionPointsOfIPanels.EXTENSIONPOINTS1_CLASSES[i++]));
73
                        }
74
                } catch (Exception e) {
75
                        e.printStackTrace();
76
                        fail();
77
                }
78
79
                System.out.println("==> ENDING TEST CLASS: \'\'PanelGroupLoaderFromExtensionPoint\'\' <==");
80
        }
81
}