svn-gvsig-desktop / trunk / libraries / libUIComponent / src-test-ui / org / gvsig / gui / beans / panelGroup / TestPanelGroupLoaderFromList.java @ 19356
History | View | Annotate | Download (2.43 KB)
1 |
/* 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 org.gvsig.gui.beans.panelGroup; |
21 |
|
22 |
import java.util.ArrayList; |
23 |
|
24 |
import junit.framework.TestCase; |
25 |
|
26 |
import org.gvsig.exceptions.BaseException; |
27 |
import org.gvsig.gui.beans.panelGroup.loaders.PanelGroupLoaderFromList; |
28 |
import org.gvsig.gui.beans.panelGroup.panels.IPanel; |
29 |
import org.gvsig.gui.beans.panelGroup.samples.Samples_Data; |
30 |
|
31 |
/**
|
32 |
* <p>Tests {@link PanelGroupLoaderUtilities PanelGroupLoaderUtilities} and {@link PanelGroupLoaderFromList PanelGroupLoaderFromList}.</p>
|
33 |
*
|
34 |
* @version 16/10/2007
|
35 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
|
36 |
*/
|
37 |
public class TestPanelGroupLoaderFromList extends TestCase { |
38 |
|
39 |
/*
|
40 |
* (non-Javadoc)
|
41 |
* @see junit.framework.TestCase#setUp()
|
42 |
*/
|
43 |
protected void setUp() throws Exception { |
44 |
super.setUp();
|
45 |
} |
46 |
|
47 |
/*
|
48 |
* (non-Javadoc)
|
49 |
* @see junit.framework.TestCase#tearDown()
|
50 |
*/
|
51 |
protected void tearDown() throws Exception { |
52 |
super.tearDown();
|
53 |
} |
54 |
|
55 |
/**
|
56 |
* <p>Test, results must be valid.</p>
|
57 |
*/
|
58 |
public void test() { |
59 |
try {
|
60 |
PanelGroupLoaderFromList loader = new PanelGroupLoaderFromList(Samples_Data.TEST2_CLASSES);
|
61 |
ArrayList<IPanel> panels = new ArrayList<IPanel>(); |
62 |
|
63 |
loader.loadPanels(panels); |
64 |
|
65 |
// Check that has loaded all panels
|
66 |
assertEquals(Samples_Data.TEST2_CLASSES.length, panels.size()); |
67 |
|
68 |
int i = 0; |
69 |
|
70 |
while (i < Samples_Data.TEST2_CLASSES.length) {
|
71 |
// Check order and class types
|
72 |
assertTrue(panels.get(i).getClass() == (Samples_Data.TEST2_CLASSES[i++])); |
73 |
} |
74 |
} catch (BaseException e) {
|
75 |
System.out.println(e.getLocalizedMessageStack());
|
76 |
fail(); |
77 |
} catch (Exception e) { |
78 |
e.printStackTrace(); |
79 |
fail(); |
80 |
} |
81 |
} |
82 |
} |