/
EnumeratedDomainTest.java
106 lines (84 loc) · 1.96 KB
/
EnumeratedDomainTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package org.ecoinformatics.datamanager.parser;
import java.util.Vector;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* @author Jing Tao
*
* JUnit tests for the EnumeratedDomain class.
*/
public class EnumeratedDomainTest extends TestCase
{
/*
* Instance fields
*/
private EnumeratedDomain domain = null;
//private int fieldWidth1 = 10;
//private int fieldWidth2 = 20;
/*
* Constructors
*/
public EnumeratedDomainTest (String name)
{
super(name);
}
/*
* Class methods
*/
/**
* Create a suite of tests to be run together
*/
public static Test suite()
{
TestSuite suite = new TestSuite();
suite.addTest(new EnumeratedDomainTest("initialize"));
suite.addTest(new EnumeratedDomainTest("testMethods"));
return suite;
}
/*
* Instance methods
*/
/**
* Establishes a testing framework by initializing appropriate objects.
*/
protected void setUp() throws Exception
{
super.setUp();
domain = new EnumeratedDomain();
}
/**
* Releases any objects after tests are complete.
*/
protected void tearDown() throws Exception
{
domain = null;
super.tearDown();
}
/**
* Tests getDomainInfoCount() and getDomainInfo() methods.
*/
public void testMethods()
{
String pattern1 = "102";
String pattern2 = "202";
Vector info = new Vector();
info.add(pattern1);
info.add(pattern2);
domain.setInfo(info);
int length = domain.getDomainInfoCount();
assertTrue(length == 2);
String gotPattern1 = domain.getDomainInfo(0);
assertEquals(pattern1, gotPattern1);
String gotPattern2 = domain.getDomainInfo(1);
assertEquals(pattern2, gotPattern2);
}
/**
* Run an initial test that always passes to check that the test
* harness is working.
*/
public void initialize()
{
assertTrue(1 == 1);
}
}