001: /*
002: * File is generated by 'Unit Tests Generator' developed under
003: * 'Web Test Tools' project at http://sf.net/projects/wttools/
004: * Copyright (C) 2001 "Artur Hefczyc" <kobit@users.sourceforge.net>
005: * to all 'Web Test Tools' subprojects.
006: *
007: * No rigths to files and no responsibility for code generated
008: * by this tool are belonged to author of 'unittestsgen' utility.
009: *
010: */
011: package org.geotools.data.vpf.io;
012:
013: import java.util.HashMap;
014:
015: import junit.framework.Test;
016: import junit.framework.TestCase;
017: import junit.framework.TestSuite;
018:
019: import org.geotools.data.vpf.ifc.DataTypesDefinition;
020:
021: /**
022: * File <code>TableRowTest.java</code> is automaticaly generated by
023: * 'unittestsgen' application. Code generator is created for java
024: * sources and for 'junit' package by "Artur Hefczyc"
025: * <kobit@users.sourceforge.net><br/>
026: * You should fulfil test methods with proper code for testing
027: * purpose. All methods where you should put your code are below and
028: * their names starts with 'test'.<br/>
029: * You can run unit tests in many ways, however prefered are:
030: * <ul>
031: * <li>Run tests for one class only, for example for this class you
032: * can run tests with command:
033: * <pre>
034: * java -cp "jar/thisjarfile.jar;lib/junit.jar" org.geotools.vpf.TableRowTest
035: * </pre>
036: * </li>
037: * <li>Run tests for all classes in one command call. Code generator
038: * creates also <code>TestAll.class</code> which runs all
039: * available tests:
040: * <pre>
041: * java -cp "jar/thisjarfile.jar;lib/junit.jar" TestAll
042: * </pre>
043: * </li>
044: * <li>But the most prefered way is to run all tests from
045: * <em>Ant</em> just after compilation process finished.<br/>
046: * To do it. You need:
047: * <ol>
048: * <li>Ant package from
049: * <a href="http://jakarta.apache.org/">Ant</a>
050: * </li>
051: * <li>JUnit package from
052: * <a href="http://www.junit.org/">JUnit</a>
053: * </li>
054: * <li>Put some code in your <code>build.xml</code> file
055: * to tell Ant how to test your package. Sample code for
056: * Ant's <code>build.xml</code> you can find in created file:
057: * <code>sample-junit-build.xml</code>. And remember to have
058: * <code>junit.jar</code> in CLASSPATH <b>before</b> you run Ant.
059: * To generate reports by ant you must have <code>xalan.jar</code>
060: * in your <code>ANT_HOME/lib/</code> directory.
061: * </li>
062: * </ol>
063: * </li>
064: * </ul>
065: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/vpf/src/test/java/org/geotools/data/vpf/io/TableRowTest.java $
066: */
067: public class TableRowTest extends TestCase implements
068: DataTypesDefinition {
069: /**
070: * Instance of tested class.
071: */
072: protected TableRow varTableRow;
073:
074: /**
075: * Public constructor for creating testing class.
076: */
077: public TableRowTest(String name) {
078: super (name);
079: } // end of TableRowTest(String name)
080:
081: /**
082: * This main method is used for run tests for this class only
083: * from command line.
084: */
085: public static void main(String[] args) {
086: junit.textui.TestRunner.run(suite());
087: } // end of main(Stringp[] args)
088:
089: public static final RowField[] TEST_FIELDS = {
090: new RowField(new Float(1f), DATA_SHORT_FLOAT),
091: new RowField(new Short((short) 2), DATA_SHORT_INTEGER),
092: new RowField(new VPFDate("200301301149.00000"),
093: DATA_DATE_TIME) };
094:
095: /**
096: * This method is called every time before particular test execution.
097: * It creates new instance of tested class and it can perform some more
098: * actions which are necessary for performs tests.
099: */
100: protected void setUp() {
101: HashMap map = new HashMap();
102: map.put("first", TEST_FIELDS[0]);
103: map.put("second", TEST_FIELDS[1]);
104: map.put("third", TEST_FIELDS[2]);
105: varTableRow = new TableRow(TEST_FIELDS, map);
106: }
107:
108: /**
109: * Returns all tests which should be performed for testing class.
110: * By default it returns only name of testing class. Instance of this
111: * is then created with its constructor.
112: */
113: public static Test suite() {
114: return new TestSuite(TableRowTest.class);
115: } // end of suite()
116:
117: /**
118: * Method for testing original source method:
119: * int fieldsCount()
120: * from tested class
121: */
122: public void testFieldsCount() {
123: assertEquals("Checking row size.", TEST_FIELDS.length,
124: varTableRow.fieldsCount());
125: } // end of testFieldsCount()
126:
127: /**
128: * Method for testing original source method:
129: * org.geotools.vpf.RowField get(java.lang.String)
130: * from tested class
131: */
132: public void testGet1195259493() {
133: assertSame("Checking method get field by name.",
134: TEST_FIELDS[0], varTableRow.get("first"));
135: assertSame("Checking method get field by name.",
136: TEST_FIELDS[1], varTableRow.get("second"));
137: assertSame("Checking method get field by name.",
138: TEST_FIELDS[2], varTableRow.get("third"));
139: } // end of testGet1195259493(java.lang.String)
140:
141: /**
142: * Method for testing original source method:
143: * org.geotools.vpf.RowField get(int)
144: * from tested class
145: */
146: public void testGet104431() {
147: assertSame("Checking method get field by index.",
148: TEST_FIELDS[0], varTableRow.get(0));
149: assertSame("Checking method get field by index.",
150: TEST_FIELDS[1], varTableRow.get(1));
151: assertSame("Checking method get field by index.",
152: TEST_FIELDS[2], varTableRow.get(2));
153: } // end of testGet104431(int)
154:
155: } // end of TableRowTest
|