KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > chart > renderer > xy > junit > RendererXYPackageTests


1 /* ===========================================================
2  * JFreeChart : a free chart library for the Java(tm) platform
3  * ===========================================================
4  *
5  * (C) Copyright 2000-2006, by Object Refinery Limited and Contributors.
6  *
7  * Project Info: http://www.jfree.org/jfreechart/index.html
8  *
9  * This library is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22  * USA.
23  *
24  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
25  * in the United States and other countries.]
26  *
27  * ---------------------------
28  * RendererXYPackageTests.java
29  * ---------------------------
30  * (C) Copyright 2004-2006, by Object Refinery Limited.
31  *
32  * Original Author: David Gilbert (for Object Refinery Limited);
33  * Contributor(s): -;
34  *
35  * $Id: RendererXYPackageTests.java,v 1.1.2.2 2006/10/25 09:51:49 mungady Exp $
36  *
37  * Changes:
38  * --------
39  * 23-Aug-2004 : Restructured org.jfree.chart.renderer package (DG);
40  * 06-Jan-2005 : Added method to create test dataset (DG);
41  * 07-Jan-2005 : Added a second method to create a test dataset (DG);
42  * 19-Jan-2005 : Added main() method to run JUnit in text mode (DG);
43  * 25-Oct-2006 : Added tests for XYErrorRenderer class (DG);
44  *
45  */

46
47 package org.jfree.chart.renderer.xy.junit;
48
49 import junit.framework.Test;
50 import junit.framework.TestCase;
51 import junit.framework.TestSuite;
52
53 import org.jfree.data.xy.DefaultTableXYDataset;
54 import org.jfree.data.xy.TableXYDataset;
55 import org.jfree.data.xy.XYSeries;
56 import org.jfree.data.xy.XYSeriesCollection;
57
58 /**
59  * A collection of tests for the org.jfree.chart.renderer.xy package.
60  * <P>
61  * These tests can be run using JUnit (http://www.junit.org).
62  */

63 public class RendererXYPackageTests extends TestCase {
64
65     /**
66      * Returns a test suite to the JUnit test runner.
67      *
68      * @return The test suite.
69      */

70     public static Test suite() {
71         TestSuite suite = new TestSuite("org.jfree.chart.renderer.xy");
72         suite.addTestSuite(AbstractXYItemRendererTests.class);
73         suite.addTestSuite(CandlestickRendererTests.class);
74         suite.addTestSuite(ClusteredXYBarRendererTests.class);
75         suite.addTestSuite(HighLowRendererTests.class);
76         suite.addTestSuite(StackedXYAreaRendererTests.class);
77         suite.addTestSuite(StackedXYAreaRenderer2Tests.class);
78         suite.addTestSuite(StackedXYBarRendererTests.class);
79         suite.addTestSuite(StandardXYItemRendererTests.class);
80         suite.addTestSuite(WindItemRendererTests.class);
81         suite.addTestSuite(XYAreaRendererTests.class);
82         suite.addTestSuite(XYAreaRenderer2Tests.class);
83         suite.addTestSuite(XYBarRendererTests.class);
84         suite.addTestSuite(XYBoxAndWhiskerRendererTests.class);
85         suite.addTestSuite(XYBubbleRendererTests.class);
86         suite.addTestSuite(XYDifferenceRendererTests.class);
87         suite.addTestSuite(XYDotRendererTests.class);
88         suite.addTestSuite(XYErrorRendererTests.class);
89         suite.addTestSuite(XYLineAndShapeRendererTests.class);
90         suite.addTestSuite(XYStepRendererTests.class);
91         suite.addTestSuite(XYStepAreaRendererTests.class);
92         suite.addTestSuite(YIntervalRendererTests.class);
93         return suite;
94     }
95
96     /**
97      * Constructs the test suite.
98      *
99      * @param name the suite name.
100      */

101     public RendererXYPackageTests(String JavaDoc name) {
102         super(name);
103     }
104     
105     /**
106      * Creates and returns a sample dataset for testing purposes.
107      *
108      * @return A sample dataset.
109      */

110     public static XYSeriesCollection createTestXYSeriesCollection() {
111         XYSeriesCollection result = new XYSeriesCollection();
112         XYSeries series1 = new XYSeries("Series 1", false, false);
113         series1.add(1.0, 2.0);
114         series1.add(2.0, 5.0);
115         XYSeries series2 = new XYSeries("Series 2", false, false);
116         series2.add(1.0, 4.0);
117         series2.add(2.0, 3.0);
118         result.addSeries(series1);
119         result.addSeries(series2);
120         return result;
121     }
122     
123     /**
124      * Creates and returns a sample dataset for testing purposes.
125      *
126      * @return A sample dataset.
127      */

128     public static TableXYDataset createTestTableXYDataset() {
129         DefaultTableXYDataset result = new DefaultTableXYDataset();
130         XYSeries series1 = new XYSeries("Series 1", false, false);
131         series1.add(1.0, 2.0);
132         series1.add(2.0, 5.0);
133         XYSeries series2 = new XYSeries("Series 2", false, false);
134         series2.add(1.0, 4.0);
135         series2.add(2.0, 3.0);
136         result.addSeries(series1);
137         result.addSeries(series2);
138         return result;
139     }
140
141     /**
142      * Runs the test suite using JUnit's text-based runner.
143      *
144      * @param args ignored.
145      */

146     public static void main(String JavaDoc[] args) {
147         junit.textui.TestRunner.run(suite());
148     }
149
150 }
151
Popular Tags