Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / test / java / org / gvsig / gui / beans / panelGroup / TestPanelGroupLoaderFromList.java @ 40561

History | View | Annotate | Download (2.53 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.gui.beans.panelGroup;
25

    
26
import java.util.ArrayList;
27

    
28
import junit.framework.TestCase;
29

    
30
import org.gvsig.tools.exception.BaseException;
31
import org.gvsig.gui.beans.panelGroup.loaders.PanelGroupLoaderFromList;
32
import org.gvsig.gui.beans.panelGroup.panels.IPanel;
33
import org.gvsig.gui.beans.panelGroup.samples.Samples_Data;
34

    
35
/**
36
 * <p>Tests {@link PanelGroupLoaderUtilities PanelGroupLoaderUtilities} and {@link PanelGroupLoaderFromList PanelGroupLoaderFromList}.</p>
37
 * 
38
 * @version 16/10/2007
39
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) 
40
 */
41
public class TestPanelGroupLoaderFromList extends TestCase {
42

    
43
        /*
44
         * (non-Javadoc)
45
         * @see junit.framework.TestCase#setUp()
46
         */
47
        protected void setUp() throws Exception {
48
                super.setUp();
49
        }
50

    
51
        /*
52
         * (non-Javadoc)
53
         * @see junit.framework.TestCase#tearDown()
54
         */
55
        protected void tearDown() throws Exception {
56
                super.tearDown();
57
        }
58

    
59
        /**
60
         * <p>Test, results must be valid.</p>
61
         */
62
        public void test() {
63
                try {
64
                        PanelGroupLoaderFromList loader = new PanelGroupLoaderFromList(Samples_Data.TEST2_CLASSES);
65
                        ArrayList<IPanel> panels = new ArrayList<IPanel>();
66

    
67
                        loader.loadPanels(panels);
68

    
69
                        // Check that has loaded all panels
70
                        assertEquals(Samples_Data.TEST2_CLASSES.length, panels.size());
71
                        
72
                        int i = 0;
73

    
74
                        while (i < Samples_Data.TEST2_CLASSES.length) {
75
                                // Check order and class types
76
                                assertTrue(panels.get(i).getClass() == (Samples_Data.TEST2_CLASSES[i++]));
77
                        }
78
                } catch (BaseException e) {
79
                        System.out.println(e.getLocalizedMessageStack());
80
                        fail();
81
                } catch (Exception e) {
82
                        e.printStackTrace();
83
                        fail();
84
                }
85
        }
86
}