You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2016/06/20 00:00:41 UTC
svn commit: r1749237 - in /poi/trunk/src/testcases/org/apache/poi/ss/util:
AllSSUtilTests.java TestCellRangeAddress.java
Author: onealj
Date: Mon Jun 20 00:00:41 2016
New Revision: 1749237
URL: http://svn.apache.org/viewvc?rev=1749237&view=rev
Log:
convert TestCellRangeAddress from junit3 to junit4
Modified:
poi/trunk/src/testcases/org/apache/poi/ss/util/AllSSUtilTests.java
poi/trunk/src/testcases/org/apache/poi/ss/util/TestCellRangeAddress.java
Modified: poi/trunk/src/testcases/org/apache/poi/ss/util/AllSSUtilTests.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/util/AllSSUtilTests.java?rev=1749237&r1=1749236&r2=1749237&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/util/AllSSUtilTests.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/util/AllSSUtilTests.java Mon Jun 20 00:00:41 2016
@@ -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,
Modified: poi/trunk/src/testcases/org/apache/poi/ss/util/TestCellRangeAddress.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/util/TestCellRangeAddress.java?rev=1749237&r1=1749236&r2=1749237&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/util/TestCellRangeAddress.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/util/TestCellRangeAddress.java Mon Jun 20 00:00:41 2016
@@ -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
assertEquals(8, CellRangeAddress.ENCODED_SIZE);
}
+ @Test
public void testLoadInvalid() {
try {
assertNotNull(new CellRangeAddress(
@@ -54,6 +57,7 @@ public final class TestCellRangeAddress
}
}
+ @Test
public void testStore() throws IOException {
CellRangeAddress ref = new CellRangeAddress(0, 0, 0, 0);
@@ -89,6 +93,7 @@ public final class TestCellRangeAddress
}
}
+ @Test
public void testCreateIllegal() throws IOException {
// for some combinations we expected exceptions
try {
@@ -105,16 +110,19 @@ public final class TestCellRangeAddress
}
}
+ @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
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
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
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
assertEquals(10, ref.getMaxColumn());
}
+ @Test
public void testIntersects() {
final CellRangeAddress baseRegion = new CellRangeAddress(0, 1, 0, 1);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org