mirror of https://github.com/apache/poi.git
convert TestCellRangeAddress from junit3 to junit4
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1749237 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c3c26ffdf3
commit
63e1afdac4
|
@ -27,7 +27,7 @@ import org.junit.runners.Suite;
|
||||||
@RunWith(Suite.class)
|
@RunWith(Suite.class)
|
||||||
@Suite.SuiteClasses({
|
@Suite.SuiteClasses({
|
||||||
TestAreaReference.class,
|
TestAreaReference.class,
|
||||||
TestCellRangeAddress.class,
|
//TestCellRangeAddress.class, //converted to junit4
|
||||||
//TestCellReference.class, //converted to junit4
|
//TestCellReference.class, //converted to junit4
|
||||||
TestDateFormatConverter.class,
|
TestDateFormatConverter.class,
|
||||||
TestExpandedDouble.class,
|
TestExpandedDouble.class,
|
||||||
|
|
|
@ -17,23 +17,25 @@ limitations under the License.
|
||||||
|
|
||||||
package org.apache.poi.ss.util;
|
package org.apache.poi.ss.util;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotEquals;
|
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.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.poi.hssf.record.TestcaseRecordInputStream;
|
import org.apache.poi.hssf.record.TestcaseRecordInputStream;
|
||||||
import org.apache.poi.util.LittleEndianByteArrayOutputStream;
|
|
||||||
import org.apache.poi.util.LittleEndianOutputStream;
|
import org.apache.poi.util.LittleEndianOutputStream;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
//TODO: replace junit3 with junit4 code
|
public final class TestCellRangeAddress {
|
||||||
import junit.framework.TestCase; //junit3
|
static final byte[] data = new byte[] { (byte) 0x02, (byte) 0x00, (byte) 0x04,
|
||||||
|
|
||||||
public final class TestCellRangeAddress extends TestCase {
|
|
||||||
byte[] data = new byte[] { (byte) 0x02, (byte) 0x00, (byte) 0x04,
|
|
||||||
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x00, };
|
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x00, };
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testLoad() {
|
public void testLoad() {
|
||||||
CellRangeAddress ref = new CellRangeAddress(
|
CellRangeAddress ref = new CellRangeAddress(
|
||||||
TestcaseRecordInputStream.create(0x000, data));
|
TestcaseRecordInputStream.create(0x000, data));
|
||||||
|
@ -45,6 +47,7 @@ public final class TestCellRangeAddress extends TestCase {
|
||||||
assertEquals(8, CellRangeAddress.ENCODED_SIZE);
|
assertEquals(8, CellRangeAddress.ENCODED_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testLoadInvalid() {
|
public void testLoadInvalid() {
|
||||||
try {
|
try {
|
||||||
assertNotNull(new CellRangeAddress(
|
assertNotNull(new CellRangeAddress(
|
||||||
|
@ -54,6 +57,7 @@ public final class TestCellRangeAddress extends TestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testStore() throws IOException {
|
public void testStore() throws IOException {
|
||||||
CellRangeAddress ref = new CellRangeAddress(0, 0, 0, 0);
|
CellRangeAddress ref = new CellRangeAddress(0, 0, 0, 0);
|
||||||
|
|
||||||
|
@ -89,6 +93,7 @@ public final class TestCellRangeAddress extends TestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testCreateIllegal() throws IOException {
|
public void testCreateIllegal() throws IOException {
|
||||||
// for some combinations we expected exceptions
|
// for some combinations we expected exceptions
|
||||||
try {
|
try {
|
||||||
|
@ -105,16 +110,19 @@ public final class TestCellRangeAddress extends TestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testCopy() throws IOException {
|
public void testCopy() throws IOException {
|
||||||
CellRangeAddress ref = new CellRangeAddress(1, 2, 3, 4);
|
CellRangeAddress ref = new CellRangeAddress(1, 2, 3, 4);
|
||||||
CellRangeAddress copy = ref.copy();
|
CellRangeAddress copy = ref.copy();
|
||||||
assertEquals(ref.toString(), copy.toString());
|
assertEquals(ref.toString(), copy.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetEncodedSize() throws IOException {
|
public void testGetEncodedSize() throws IOException {
|
||||||
assertEquals(2*CellRangeAddress.ENCODED_SIZE, CellRangeAddress.getEncodedSize(2));
|
assertEquals(2*CellRangeAddress.ENCODED_SIZE, CellRangeAddress.getEncodedSize(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testFormatAsString() throws IOException {
|
public void testFormatAsString() throws IOException {
|
||||||
CellRangeAddress ref = new CellRangeAddress(1, 2, 3, 4);
|
CellRangeAddress ref = new CellRangeAddress(1, 2, 3, 4);
|
||||||
|
|
||||||
|
@ -169,6 +177,7 @@ public final class TestCellRangeAddress extends TestCase {
|
||||||
assertEquals(":", ref.formatAsString());
|
assertEquals(":", ref.formatAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testEquals() {
|
public void testEquals() {
|
||||||
final CellRangeAddress ref1 = new CellRangeAddress(1, 2, 3, 4);
|
final CellRangeAddress ref1 = new CellRangeAddress(1, 2, 3, 4);
|
||||||
final CellRangeAddress ref2 = 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));
|
assertNotEquals(ref1, new CellRangeAddress(3, 4, 1, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetMinMaxRow() {
|
public void testGetMinMaxRow() {
|
||||||
final CellRangeAddress ref = new CellRangeAddress(1, 2, 3, 4);
|
final CellRangeAddress ref = new CellRangeAddress(1, 2, 3, 4);
|
||||||
assertEquals(1, ref.getMinRow());
|
assertEquals(1, ref.getMinRow());
|
||||||
|
@ -199,6 +209,7 @@ public final class TestCellRangeAddress extends TestCase {
|
||||||
assertEquals(10, ref.getMaxRow());
|
assertEquals(10, ref.getMaxRow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetMinMaxColumn() {
|
public void testGetMinMaxColumn() {
|
||||||
final CellRangeAddress ref = new CellRangeAddress(1, 2, 3, 4);
|
final CellRangeAddress ref = new CellRangeAddress(1, 2, 3, 4);
|
||||||
assertEquals(3, ref.getMinColumn());
|
assertEquals(3, ref.getMinColumn());
|
||||||
|
@ -210,6 +221,7 @@ public final class TestCellRangeAddress extends TestCase {
|
||||||
assertEquals(10, ref.getMaxColumn());
|
assertEquals(10, ref.getMaxColumn());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testIntersects() {
|
public void testIntersects() {
|
||||||
final CellRangeAddress baseRegion = new CellRangeAddress(0, 1, 0, 1);
|
final CellRangeAddress baseRegion = new CellRangeAddress(0, 1, 0, 1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue