]> source.dussan.org Git - poi.git/commitdiff
convert TestCellRangeAddress from junit3 to junit4
authorJaven O'Neal <onealj@apache.org>
Mon, 20 Jun 2016 00:00:41 +0000 (00:00 +0000)
committerJaven O'Neal <onealj@apache.org>
Mon, 20 Jun 2016 00:00:41 +0000 (00:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1749237 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/ss/util/AllSSUtilTests.java
src/testcases/org/apache/poi/ss/util/TestCellRangeAddress.java

index 0db1e7fbcc481ee0b8de1f345dac639476e54561..569fadce7122b5c721ee3d8540705d5c2cf94818 100644 (file)
@@ -27,7 +27,7 @@ import org.junit.runners.Suite;
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
     TestAreaReference.class,
-    TestCellRangeAddress.class,
+    //TestCellRangeAddress.class, //converted to junit4
     //TestCellReference.class, //converted to junit4
     TestDateFormatConverter.class,
     TestExpandedDouble.class,
index 8198f56b47cb28d0eca5c1de1c55ab64a04fb6ab..e11d3cf039a55f13e79231016ab978c6bcdbacda 100644 (file)
@@ -17,23 +17,25 @@ limitations under the License.
 
 package org.apache.poi.ss.util;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
 import org.apache.poi.hssf.record.TestcaseRecordInputStream;
-import org.apache.poi.util.LittleEndianByteArrayOutputStream;
 import org.apache.poi.util.LittleEndianOutputStream;
 
+import org.junit.Test;
 
-//TODO: replace junit3 with junit4 code
-import junit.framework.TestCase; //junit3
-
-public final class TestCellRangeAddress extends TestCase {
-    byte[] data = new byte[] { (byte) 0x02, (byte) 0x00, (byte) 0x04,
+public final class TestCellRangeAddress {
+    static final byte[] data = new byte[] { (byte) 0x02, (byte) 0x00, (byte) 0x04,
             (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x00, };
 
+    @Test
     public void testLoad() {
         CellRangeAddress ref = new CellRangeAddress(
                 TestcaseRecordInputStream.create(0x000, data));
@@ -45,6 +47,7 @@ public final class TestCellRangeAddress extends TestCase {
         assertEquals(8, CellRangeAddress.ENCODED_SIZE);
     }
 
+    @Test
     public void testLoadInvalid() {
         try {
             assertNotNull(new CellRangeAddress(
@@ -54,6 +57,7 @@ public final class TestCellRangeAddress extends TestCase {
         }
     }
 
+    @Test
     public void testStore() throws IOException {
         CellRangeAddress ref = new CellRangeAddress(0, 0, 0, 0);
 
@@ -89,6 +93,7 @@ public final class TestCellRangeAddress extends TestCase {
         }
     }
     
+    @Test
     public void testCreateIllegal() throws IOException {
         // for some combinations we expected exceptions
         try {
@@ -105,16 +110,19 @@ public final class TestCellRangeAddress extends TestCase {
         }
     }
 
+    @Test
     public void testCopy() throws IOException {
         CellRangeAddress ref = new CellRangeAddress(1, 2, 3, 4);
         CellRangeAddress copy = ref.copy();
         assertEquals(ref.toString(), copy.toString());
     }
 
+    @Test
     public void testGetEncodedSize() throws IOException {
         assertEquals(2*CellRangeAddress.ENCODED_SIZE, CellRangeAddress.getEncodedSize(2));
     }
 
+    @Test
     public void testFormatAsString() throws IOException {
         CellRangeAddress ref = new CellRangeAddress(1, 2, 3, 4);
         
@@ -169,6 +177,7 @@ public final class TestCellRangeAddress extends TestCase {
         assertEquals(":", ref.formatAsString());
     }
     
+    @Test
     public void testEquals() {
         final CellRangeAddress ref1 = new CellRangeAddress(1, 2, 3, 4);
         final CellRangeAddress ref2 = new CellRangeAddress(1, 2, 3, 4);
@@ -188,6 +197,7 @@ public final class TestCellRangeAddress extends TestCase {
         assertNotEquals(ref1, new CellRangeAddress(3, 4, 1, 2));
     }
     
+    @Test
     public void testGetMinMaxRow() {
         final CellRangeAddress ref = new CellRangeAddress(1, 2, 3, 4);
         assertEquals(1, ref.getMinRow());
@@ -199,6 +209,7 @@ public final class TestCellRangeAddress extends TestCase {
         assertEquals(10, ref.getMaxRow());
     }
     
+    @Test
     public void testGetMinMaxColumn() {
         final CellRangeAddress ref = new CellRangeAddress(1, 2, 3, 4);
         assertEquals(3, ref.getMinColumn());
@@ -210,6 +221,7 @@ public final class TestCellRangeAddress extends TestCase {
         assertEquals(10, ref.getMaxColumn());
     }
     
+    @Test
     public void testIntersects() {
         final CellRangeAddress baseRegion = new CellRangeAddress(0, 1, 0, 1);