aboutsummaryrefslogtreecommitdiff
blob: c9cd02d554bed9d6d3cb62fd8eb00b83b9d0bd1c (plain)
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
From b9edd6a86e66d354b0c1d010125246d8359cbb37 Mon Sep 17 00:00:00 2001
From: W. Trevor King <wking@drexel.edu>
Date: Fri, 7 Oct 2011 03:44:18 -0400
Subject: [PATCH 7/8] Update ArrayFuncsTest.java to JUnit-4.

---
 src/nom/tam/util/test/ArrayFuncsTest.java |   44 +++++++++++++++++++---------
 1 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/src/nom/tam/util/test/ArrayFuncsTest.java b/src/nom/tam/util/test/ArrayFuncsTest.java
index df5efb0..7ad8e51 100644
--- a/src/nom/tam/util/test/ArrayFuncsTest.java
+++ b/src/nom/tam/util/test/ArrayFuncsTest.java
@@ -6,6 +6,12 @@
  */
 package nom.tam.util.test;
 
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertNotSame;
 import junit.framework.*;
 import java.lang.reflect.*;
 import java.util.Arrays;
@@ -15,21 +21,12 @@ import nom.tam.util.ArrayFuncs;
  *
  * @author Thomas McGlynn
  */
-public class ArrayFuncsTest extends TestCase {
-
-    public ArrayFuncsTest(String testName) {
-        super(testName);
-    }
-
-    protected void setUp() throws Exception {
-    }
-
-    protected void tearDown() throws Exception {
-    }
+public class ArrayFuncsTest {
 
     /**
      * Test of computeSize method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testComputeSize() {
         System.out.println("computeSize");
 
@@ -58,6 +55,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of nElements method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testNElements() {
         System.out.println("nElements");
 
@@ -72,6 +70,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of deepClone method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testDeepClone() {
         int[][] test = {{0, 1}, {2, 3}, {4, 5}};
         int[][] result = (int[][]) nom.tam.util.ArrayFuncs.deepClone(test);
@@ -96,6 +95,7 @@ public class ArrayFuncsTest extends TestCase {
         }
 
         public boolean equals(Object x) {
+	    System.out.println("checking equality");
             return (x instanceof CloneTest)
                     && (((CloneTest) x).value == this.value);
         }
@@ -104,6 +104,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of genericClone method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testGenericClone() {
         System.out.println("genericClone");
 
@@ -126,6 +127,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of copyArray method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testCopyArray() {
         System.out.println("copyArray");
 
@@ -138,6 +140,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of getDimensions method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testGetDimensions() {
         System.out.println("getDimensions");
 
@@ -157,6 +160,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of getBaseArray method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testGetBaseArray() {
 
         int[][][] test = new int[2][3][4];
@@ -169,6 +173,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of getBaseClass method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testGetBaseClass() {
         System.out.println("getBaseClass");
 
@@ -179,6 +184,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of getBaseLength method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testGetBaseLength() {
 
         assertEquals(ArrayFuncs.getBaseLength(new int[2][3]), 4);
@@ -195,6 +201,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of generateArray method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testGenerateArray() {
         System.out.println("generateArray");
 
@@ -213,6 +220,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of testPattern method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testTestPattern() {
         System.out.println("testPattern");
 
@@ -229,6 +237,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of flatten method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testFlatten() {
         System.out.println("flatten");
 
@@ -241,6 +250,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of curl method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testCurl() {
         System.out.println("curl");
 
@@ -259,6 +269,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of mimicArray method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testMimicArray() {
         System.out.println("mimicArray");
 
@@ -273,6 +284,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of convertArray method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testConvertArray() {
         System.out.println("convertArray");
 
@@ -286,7 +298,7 @@ public class ArrayFuncsTest extends TestCase {
 
         newType = int.class;
         int[][] ires = (int[][]) ArrayFuncs.convertArray(array, newType, true);
-        assertEquals(array, ires);
+        assertSame(array, ires);
 
         ires = (int[][]) ArrayFuncs.convertArray(array, newType, false);
         assertNotSame(array, ires);
@@ -296,6 +308,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of copyInto method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testCopyInto() {
         System.out.println("copyInto");
 
@@ -304,13 +317,14 @@ public class ArrayFuncsTest extends TestCase {
 
         ArrayFuncs.copyInto(x, y);
 
-        assertEquals((double) x[0][0], y[0][0]);
-        assertEquals((double) x[1][2], y[1][2]);
+        assertEquals((double) x[0][0], y[0][0], 0.01);
+        assertEquals((double) x[1][2], y[1][2], 0.01);
     }
 
     /**
      * Test of arrayEquals method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testArrayEquals() {
         System.out.println("arrayEquals");
 
@@ -331,6 +345,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of doubleArrayEquals method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testDoubleArrayEquals() {
 
         double x[] = {1, 2, 3};
@@ -349,6 +364,7 @@ public class ArrayFuncsTest extends TestCase {
     /**
      * Test of floatArrayEquals method, of class nom.tam.util.ArrayFuncs.
      */
+    @Test
     public void testFloatArrayEquals() {
         float x[] = {1f, 2f, 3f};
         float y[] = {1f, 2f, 3f};
-- 
1.7.3.1.104.gc752e