Move one testcase with incorrect source location

remove some junit dependencies in example-code
build: do not pass junit-jar to normal compile targets to avoid introducing it as dependency again 
Reformat code, fix warnings, ...

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1798202 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2017-06-09 12:49:01 +00:00
parent 20ed0075e8
commit 902124a5fd
9 changed files with 182 additions and 183 deletions

View File

@ -325,12 +325,15 @@ under the License.
<path id="main.classpath"> <path id="main.classpath">
<pathelement location="${main.commons-logging.jar}"/> <pathelement location="${main.commons-logging.jar}"/>
<pathelement location="${main.commons-codec.jar}"/> <pathelement location="${main.commons-codec.jar}"/>
<pathelement location="${main.log4j.jar}"/> <pathelement location="${main.commons-collections4.jar}"/>
</path>
<!-- some libraries should only be required for compiling/running tests -->
<path id="test.jar.classpath">
<pathelement location="${main.junit.jar}"/> <pathelement location="${main.junit.jar}"/>
<pathelement location="${main.jmh.jar}"/> <pathelement location="${main.jmh.jar}"/>
<pathelement location="${main.jmhAnnotation.jar}"/> <pathelement location="${main.jmhAnnotation.jar}"/>
<pathelement location="${main.hamcrest.jar}"/> <pathelement location="${main.hamcrest.jar}"/>
<pathelement location="${main.commons-collections4.jar}"/>
</path> </path>
<path id="scratchpad.classpath"> <path id="scratchpad.classpath">
@ -375,6 +378,7 @@ under the License.
<path id="test.ooxml.classpath"> <path id="test.ooxml.classpath">
<path refid="ooxml.classpath"/> <path refid="ooxml.classpath"/>
<path refid="test.jar.classpath"/>
<pathelement location="${ooxml.output.dir}"/> <pathelement location="${ooxml.output.dir}"/>
<pathelement location="${ooxml.output.test.dir}"/> <pathelement location="${ooxml.output.test.dir}"/>
<pathelement location="${main.output.test.dir}"/> <pathelement location="${main.output.test.dir}"/>
@ -385,6 +389,7 @@ under the License.
<pathelement location="${integration.src.test}"/> <pathelement location="${integration.src.test}"/>
<path refid="scratchpad.classpath"/> <path refid="scratchpad.classpath"/>
<path refid="ooxml.classpath"/> <path refid="ooxml.classpath"/>
<path refid="test.jar.classpath"/>
<pathelement location="${main.output.test.dir}"/> <pathelement location="${main.output.test.dir}"/>
<pathelement location="${ooxml.output.dir}"/> <pathelement location="${ooxml.output.dir}"/>
<pathelement location="${integration.output.test.dir}"/> <pathelement location="${integration.output.test.dir}"/>
@ -420,6 +425,7 @@ under the License.
<path id="test.excelant.classpath"> <path id="test.excelant.classpath">
<path refid="ooxml.classpath"/> <path refid="ooxml.classpath"/>
<path refid="test.jar.classpath"/>
<pathelement location="${ooxml.output.dir}"/> <pathelement location="${ooxml.output.dir}"/>
<pathelement location="${excelant.output.dir}"/> <pathelement location="${excelant.output.dir}"/>
<pathelement location="${excelant.output.test.dir}"/> <pathelement location="${excelant.output.test.dir}"/>
@ -857,6 +863,10 @@ under the License.
includeantruntime="false"> includeantruntime="false">
<!-- debug="${compile.debug}" --> <!-- debug="${compile.debug}" -->
<classpath refid="ooxml.classpath"/> <classpath refid="ooxml.classpath"/>
<!-- unfortunately JUnit is required here for OOXMLLite, we should rather move OOXMLLite
to test or a separate folder to clean up dependencies -->
<classpath location="${main.junit.jar}"/>
</javac> </javac>
<jar basedir="${xmlbean.classes.dir}" destfile="@{classes-jar}" excludes="org/apache/**" level="9" /> <jar basedir="${xmlbean.classes.dir}" destfile="@{classes-jar}" excludes="org/apache/**" level="9" />
@ -918,6 +928,7 @@ under the License.
includeantruntime="false"> includeantruntime="false">
<classpath> <classpath>
<path refid="main.classpath"/> <path refid="main.classpath"/>
<path refid="test.jar.classpath"/>
<pathelement path="${main.output.dir}"/> <pathelement path="${main.output.dir}"/>
</classpath> </classpath>
</javac> </javac>
@ -981,6 +992,7 @@ under the License.
includeantruntime="false"> includeantruntime="false">
<classpath> <classpath>
<path refid="scratchpad.classpath"/> <path refid="scratchpad.classpath"/>
<path refid="test.jar.classpath"/>
<pathelement location="${scratchpad.output.dir}"/> <pathelement location="${scratchpad.output.dir}"/>
<pathelement location="${main.output.test.dir}"/> <pathelement location="${main.output.test.dir}"/>
</classpath> </classpath>
@ -1024,6 +1036,10 @@ under the License.
<classpath> <classpath>
<path refid="ooxml.classpath"/> <path refid="ooxml.classpath"/>
<path refid="ooxml.xmlsec.classpath"/> <path refid="ooxml.xmlsec.classpath"/>
<!-- unfortunately JUnit is required here for OOXMLLite, we should rather move OOXMLLite
to test or a separate folder to clean up dependencies -->
<pathelement location="${main.junit.jar}"/>
</classpath> </classpath>
</javac> </javac>
<!-- compile the tests --> <!-- compile the tests -->
@ -1114,6 +1130,7 @@ under the License.
includeantruntime="false"> includeantruntime="false">
<classpath> <classpath>
<path refid="excelant.classpath"/> <path refid="excelant.classpath"/>
<path refid="test.jar.classpath"/>
<pathelement location="${excelant.output.dir}"/> <pathelement location="${excelant.output.dir}"/>
<pathelement path="${main.output.test.dir}"/> <pathelement path="${main.output.test.dir}"/>
</classpath> </classpath>
@ -1135,6 +1152,7 @@ under the License.
<classpath> <classpath>
<path refid="scratchpad.classpath"/> <path refid="scratchpad.classpath"/>
<path refid="ooxml.classpath"/> <path refid="ooxml.classpath"/>
<path refid="test.jar.classpath"/>
<pathelement location="${ooxml.output.dir}"/> <pathelement location="${ooxml.output.dir}"/>
<pathelement location="${main.output.test.dir}"/> <pathelement location="${main.output.test.dir}"/>
<pathelement location="${examples.output.dir}"/> <pathelement location="${examples.output.dir}"/>
@ -1274,6 +1292,7 @@ under the License.
<junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="${halt.on.test.failure}" <junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="${halt.on.test.failure}"
failureproperty="main.test.failed" showoutput="true"> failureproperty="main.test.failed" showoutput="true">
<classpath refid="test.classpath"/> <classpath refid="test.classpath"/>
<classpath refid="test.jar.classpath"/>
<syspropertyset refid="junit.properties"/> <syspropertyset refid="junit.properties"/>
<jvmarg value="-ea"/> <jvmarg value="-ea"/>
<jvmarg value="-Xmx256m"/> <jvmarg value="-Xmx256m"/>
@ -1391,6 +1410,7 @@ under the License.
<junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}" <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
failureproperty="scratchpad.test.failed"> failureproperty="scratchpad.test.failed">
<classpath refid="test.scratchpad.classpath"/> <classpath refid="test.scratchpad.classpath"/>
<classpath refid="test.jar.classpath"/>
<syspropertyset refid="junit.properties"/> <syspropertyset refid="junit.properties"/>
<jvmarg value="-ea"/> <jvmarg value="-ea"/>
<!-- jvmarg value="-Duser.timezone=UTC"/ --> <!-- jvmarg value="-Duser.timezone=UTC"/ -->
@ -1443,7 +1463,10 @@ under the License.
<jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-@{type}.exec"> <jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-@{type}.exec">
<junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}" <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
failureproperty="ooxml.test.failed"> failureproperty="ooxml.test.failed">
<classpath refid="@{classpath}"/> <classpath>
<path refid="@{classpath}"/>
<path refid="test.jar.classpath"/>
</classpath>
<syspropertyset refid="junit.properties"/> <syspropertyset refid="junit.properties"/>
<jvmarg value="${maxpermsize}"/> <jvmarg value="${maxpermsize}"/>
<jvmarg value="-Xmx768M"/> <jvmarg value="-Xmx768M"/>
@ -1476,6 +1499,7 @@ under the License.
failureproperty="ooxml.xmlsec.test.failed"> failureproperty="ooxml.xmlsec.test.failed">
<classpath> <classpath>
<path refid="@{classpath}"/> <path refid="@{classpath}"/>
<path refid="test.jar.classpath"/>
<path refid="ooxml.xmlsec.classpath"/> <path refid="ooxml.xmlsec.classpath"/>
</classpath> </classpath>
<syspropertyset refid="junit.properties"/> <syspropertyset refid="junit.properties"/>

View File

@ -19,8 +19,6 @@
package org.apache.poi.xwpf.usermodel.examples; package org.apache.poi.xwpf.usermodel.examples;
import static org.junit.Assert.assertEquals;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -77,7 +75,7 @@ public class UpdateEmbeddedDoc {
this.docFile = new File(filename); this.docFile = new File(filename);
FileInputStream fis = null; FileInputStream fis = null;
if (!this.docFile.exists()) { if (!this.docFile.exists()) {
throw new FileNotFoundException("The Word dcoument " + filename + " does not exist."); throw new FileNotFoundException("The Word document " + filename + " does not exist.");
} }
try { try {
// Open the Word document file and instantiate the XWPFDocument // Open the Word document file and instantiate the XWPFDocument
@ -90,7 +88,7 @@ public class UpdateEmbeddedDoc {
} }
/** /**
* Called to update the embedded Excel workbook. As the format and structire * Called to update the embedded Excel workbook. As the format and structure
* of the workbook are known in advance, all this code attempts to do is * of the workbook are known in advance, all this code attempts to do is
* write a new value into the first cell on the first row of the first * write a new value into the first cell on the first row of the first
* worksheet. Prior to executing this method, that cell will contain the * worksheet. Prior to executing this method, that cell will contain the
@ -99,7 +97,7 @@ public class UpdateEmbeddedDoc {
* @throws org.apache.poi.openxml4j.exceptions.OpenXML4JException * @throws org.apache.poi.openxml4j.exceptions.OpenXML4JException
* Rather * Rather
* than use the specific classes (HSSF/XSSF) to handle the embedded * than use the specific classes (HSSF/XSSF) to handle the embedded
* workbook this method uses those defeined in the SS stream. As * workbook this method uses those defined in the SS stream. As
* a result, it might be the case that a SpreadsheetML file is * a result, it might be the case that a SpreadsheetML file is
* opened for processing, throwing this exception if that file is * opened for processing, throwing this exception if that file is
* invalid. * invalid.
@ -160,7 +158,7 @@ public class UpdateEmbeddedDoc {
* @throws org.apache.poi.openxml4j.exceptions.OpenXML4JException * @throws org.apache.poi.openxml4j.exceptions.OpenXML4JException
* Rather * Rather
* than use the specific classes (HSSF/XSSF) to handle the embedded * than use the specific classes (HSSF/XSSF) to handle the embedded
* workbook this method uses those defeined in the SS stream. As * workbook this method uses those defined in the SS stream. As
* a result, it might be the case that a SpreadsheetML file is * a result, it might be the case that a SpreadsheetML file is
* opened for processing, throwing this exception if that file is * opened for processing, throwing this exception if that file is
* invalid. * invalid.
@ -178,7 +176,9 @@ public class UpdateEmbeddedDoc {
Sheet sheet = workbook.getSheetAt(SHEET_NUM); Sheet sheet = workbook.getSheetAt(SHEET_NUM);
Row row = sheet.getRow(ROW_NUM); Row row = sheet.getRow(ROW_NUM);
Cell cell = row.getCell(CELL_NUM); Cell cell = row.getCell(CELL_NUM);
assertEquals(cell.getNumericCellValue(), NEW_VALUE, 0.0001); if(cell.getNumericCellValue() != NEW_VALUE) {
throw new IllegalStateException("Failed to validate document content.");
}
} finally { } finally {
IOUtils.closeQuietly(workbook); IOUtils.closeQuietly(workbook);
IOUtils.closeQuietly(is); IOUtils.closeQuietly(is);
@ -189,9 +189,6 @@ public class UpdateEmbeddedDoc {
/** /**
* Code to test updating of the embedded Excel workbook. * Code to test updating of the embedded Excel workbook.
*
* @param args
* @throws OpenXML4JException
*/ */
public static void main(String[] args) throws IOException, OpenXML4JException { public static void main(String[] args) throws IOException, OpenXML4JException {
UpdateEmbeddedDoc ued = new UpdateEmbeddedDoc(args[0]); UpdateEmbeddedDoc ued = new UpdateEmbeddedDoc(args[0]);

View File

@ -91,6 +91,7 @@ public class SheetUtil {
public void evaluateAll() {} public void evaluateAll() {}
@Override @Override
public int evaluateFormulaCell(Cell cell) { public int evaluateFormulaCell(Cell cell) {
//noinspection deprecation
return cell.getCachedFormulaResultType(); return cell.getCachedFormulaResultType();
} }
/** /**
@ -157,9 +158,9 @@ public class SheetUtil {
AttributedString str = new AttributedString(txt); AttributedString str = new AttributedString(txt);
copyAttributes(font, str, 0, txt.length()); copyAttributes(font, str, 0, txt.length());
if (rt.numFormattingRuns() > 0) { /*if (rt.numFormattingRuns() > 0) {
// TODO: support rich text fragments // TODO: support rich text fragments
} }*/
width = getCellWidth(defaultCharWidth, colspan, style, width, str); width = getCellWidth(defaultCharWidth, colspan, style, width, str);
} }
@ -329,7 +330,7 @@ public class SheetUtil {
/** /**
* Copy text attributes from the supplied Font to Java2D AttributedString * Copy text attributes from the supplied Font to Java2D AttributedString
*/ */
private static void copyAttributes(Font font, AttributedString str, int startIdx, int endIdx) { private static void copyAttributes(Font font, AttributedString str, @SuppressWarnings("SameParameterValue") int startIdx, int endIdx) {
str.addAttribute(TextAttribute.FAMILY, font.getFontName(), startIdx, endIdx); str.addAttribute(TextAttribute.FAMILY, font.getFontName(), startIdx, endIdx);
str.addAttribute(TextAttribute.SIZE, (float)font.getFontHeightInPoints()); str.addAttribute(TextAttribute.SIZE, (float)font.getFontHeightInPoints());
if (font.getBold()) str.addAttribute(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD, startIdx, endIdx); if (font.getBold()) str.addAttribute(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD, startIdx, endIdx);
@ -360,9 +361,9 @@ public class SheetUtil {
* Use this where you want to know if the given cell is explicitly defined * Use this where you want to know if the given cell is explicitly defined
* or not. * or not.
* *
* @param sheet * @param sheet The workbook sheet to look at.
* @param rowIx * @param rowIx The 0-based index of the row.
* @param colIx * @param colIx The 0-based index of the cell.
* @return cell at the given location, or null if not defined * @return cell at the given location, or null if not defined
* @throws NullPointerException if sheet is null * @throws NullPointerException if sheet is null
*/ */
@ -385,9 +386,9 @@ public class SheetUtil {
* <p>If there is no cell defined at the given co-ordinates, will return * <p>If there is no cell defined at the given co-ordinates, will return
* null. * null.
* *
* @param sheet * @param sheet The workbook sheet to look at.
* @param rowIx * @param rowIx The 0-based index of the row.
* @param colIx * @param colIx The 0-based index of the cell.
* @return cell at the given location, its base merged cell, or null if not defined * @return cell at the given location, its base merged cell, or null if not defined
* @throws NullPointerException if sheet is null * @throws NullPointerException if sheet is null
*/ */

View File

@ -143,9 +143,7 @@ public final class OOXMLLite {
copyFile(cls.getResourceAsStream('/' + classRef), destFile); copyFile(cls.getResourceAsStream('/' + classRef), destFile);
if(cls.isInterface()){ if(cls.isInterface()){
/** /// Copy classes and interfaces declared as members of this class
* Copy classes and interfaces declared as members of this class
*/
for(Class<?> fc : cls.getDeclaredClasses()){ for(Class<?> fc : cls.getDeclaredClasses()){
className = fc.getName(); className = fc.getName();
classRef = className.replace('.', '/') + ".class"; classRef = className.replace('.', '/') + ".class";
@ -235,7 +233,6 @@ public final class OOXMLLite {
} }
} catch (Throwable e) { // NOSONAR } catch (Throwable e) { // NOSONAR
System.out.println("Class " + cls + " is not in classpath"); System.out.println("Class " + cls + " is not in classpath");
return;
} }
} }
} }

View File

@ -948,15 +948,16 @@ public final class TestPackage {
// bug 60128 // bug 60128
@Test @Test
public void testCorruptFile() throws IOException { public void testCorruptFile() throws IOException, InvalidFormatException {
OPCPackage pkg = null; OPCPackage pkg = null;
File file = OpenXML4JTestDataSamples.getSampleFile("invalid.xlsx"); File file = OpenXML4JTestDataSamples.getSampleFile("invalid.xlsx");
try { try {
pkg = OPCPackage.open(file, PackageAccess.READ); pkg = OPCPackage.open(file, PackageAccess.READ);
} catch (Exception e) { } catch (NotOfficeXmlFileException e) {
System.out.println(e.getClass().getName()); /*System.out.println(e.getClass().getName());
System.out.println(e.getMessage()); System.out.println(e.getMessage());
e.printStackTrace(); e.printStackTrace();*/
// ignore exception
} finally { } finally {
if (pkg != null) { if (pkg != null) {
pkg.close(); pkg.close();

View File

@ -19,36 +19,27 @@ package org.apache.poi.hwpf.model;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil; import org.apache.poi.util.StringUtil;
@Internal @Internal
public final class PieceDescriptor public final class PieceDescriptor {
{ private final short descriptor;
int fc; // used from the outside?!?
short descriptor; private final PropertyModifier prm;
private static BitField fNoParaLast = BitFieldFactory.getInstance(0x01); private final boolean unicode;
private static BitField fPaphNil = BitFieldFactory.getInstance(0x02);
private static BitField fCopied = BitFieldFactory.getInstance(0x04);
int fc;
PropertyModifier prm;
boolean unicode = false;
private final Charset charset; private final Charset charset;
public PieceDescriptor(byte[] buf, int offset) { public PieceDescriptor(byte[] buf, int offset) {
this(buf, offset, null); this(buf, offset, null);
} }
/** /**
*
* This initializer should only be used for HWPFOldDocuments. * This initializer should only be used for HWPFOldDocuments.
* *
* @param buf * @param buf The buffer to read data from
* @param offset * @param offset The offset into the buffer to start reading from
* @param charset which charset to use if this is not unicode * @param charset which charset to use if this is not unicode
*/ */
public PieceDescriptor(byte[] buf, int offset, Charset charset) { public PieceDescriptor(byte[] buf, int offset, Charset charset) {
@ -76,29 +67,37 @@ public final class PieceDescriptor
} else { } else {
if (charset == StringUtil.UTF16LE) { if (charset == StringUtil.UTF16LE) {
unicode = true; unicode = true;
} else {
unicode = false;
} }
this.charset = charset; this.charset = charset;
} }
} }
public int getFilePosition() public int getFilePosition() {
{
return fc; return fc;
} }
public void setFilePosition(int pos) public void setFilePosition(int pos) {
{
fc = pos; fc = pos;
} }
public boolean isUnicode() public boolean isUnicode() {
{
return unicode; return unicode;
} }
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + descriptor;
result = prime * result + ( ( prm == null ) ? 0 : prm.hashCode() );
result = prime * result + ( unicode ? 1231 : 1237 );
return result;
}
/** /**
*
* @return charset to use if this is not a Unicode PieceDescriptor * @return charset to use if this is not a Unicode PieceDescriptor
* this can be <code>null</code> * this can be <code>null</code>
*/ */
@ -106,17 +105,14 @@ public final class PieceDescriptor
return charset; return charset;
} }
public PropertyModifier getPrm() public PropertyModifier getPrm() {
{
return prm; return prm;
} }
protected byte[] toByteArray() protected byte[] toByteArray() {
{
// set up the fc // set up the fc
int tempFc = fc; int tempFc = fc;
if (!unicode) if (!unicode) {
{
tempFc *= 2; tempFc *= 2;
tempFc |= (0x40000000); tempFc |= (0x40000000);
} }
@ -130,28 +126,14 @@ public final class PieceDescriptor
LittleEndian.putShort(buf, offset, prm.getValue()); LittleEndian.putShort(buf, offset, prm.getValue());
return buf; return buf;
} }
public static int getSizeInBytes() public static int getSizeInBytes() {
{
return 8; return 8;
} }
@Override @Override
public int hashCode() public boolean equals(Object obj) {
{
final int prime = 31;
int result = 1;
result = prime * result + descriptor;
result = prime * result + ( ( prm == null ) ? 0 : prm.hashCode() );
result = prime * result + ( unicode ? 1231 : 1237 );
return result;
}
@Override
public boolean equals( Object obj )
{
if (this == obj) if (this == obj)
return true; return true;
if (obj == null) if (obj == null)
@ -161,12 +143,10 @@ public final class PieceDescriptor
PieceDescriptor other = (PieceDescriptor) obj; PieceDescriptor other = (PieceDescriptor) obj;
if (descriptor != other.descriptor) if (descriptor != other.descriptor)
return false; return false;
if ( prm == null ) if (prm == null) {
{
if (other.prm != null) if (other.prm != null)
return false; return false;
} } else if (!prm.equals(other.prm))
else if ( !prm.equals( other.prm ) )
return false; return false;
if (unicode != other.unicode) if (unicode != other.unicode)
return false; return false;
@ -174,8 +154,7 @@ public final class PieceDescriptor
} }
@Override @Override
public String toString() public String toString() {
{
return "PieceDescriptor (pos: " + getFilePosition() + "; " return "PieceDescriptor (pos: " + getFilePosition() + "; "
+ (isUnicode() ? "unicode" : "non-unicode") + "; prm: " + (isUnicode() ? "unicode" : "non-unicode") + "; prm: "
+ getPrm() + ")"; + getPrm() + ")";

View File

@ -37,8 +37,8 @@ import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue; import static org.junit.Assume.assumeTrue;
/** /**
* Common superclass for testing {@link org.apache.poi.xssf.usermodel.XSSFCell} and * Common superclass for testing {@link HSSFCell}, org.apache.poi.xssf.usermodel.XSSFCell and
* {@link org.apache.poi.hssf.usermodel.HSSFCell} * org.apache.poi.xssf.streaming.SXSSFCell
*/ */
public abstract class BaseTestSheet { public abstract class BaseTestSheet {
private static final int ROW_COUNT = 40000; private static final int ROW_COUNT = 40000;
@ -417,7 +417,7 @@ public abstract class BaseTestSheet {
//should exist now! //should exist now!
assertTrue("there isn't more than one merged region in there", 1 <= sheet.getNumMergedRegions()); assertTrue("there isn't more than one merged region in there", 1 <= sheet.getNumMergedRegions());
region = sheet.getMergedRegion(0); region = sheet.getMergedRegion(0);
assertEquals("the merged row to doesnt match the one we put in ", 4, region.getLastRow()); assertEquals("the merged row to doesn't match the one we put in ", 4, region.getLastRow());
wb.close(); wb.close();
} }