mirror of
https://github.com/apache/poi.git
synced 2025-02-11 12:34:51 +00:00
Sonar fixes - Tests should include assertions
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1872302 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4aa8334e3b
commit
d66af200eb
@ -17,8 +17,11 @@
|
||||
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.poi.util.HexDump;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.util.RecordFormatException;
|
||||
|
||||
/**
|
||||
* Title: Bound Sheet Record (aka BundleSheet) (0x0085) for BIFF 5<P>
|
||||
@ -44,6 +47,17 @@ public final class OldSheetRecord {
|
||||
field_2_visibility = in.readUByte();
|
||||
field_3_type = in.readUByte();
|
||||
int field_4_sheetname_length = in.readUByte();
|
||||
in.mark(1);
|
||||
byte b = in.readByte();
|
||||
// if the sheet name starts with a 0, we need to skip one byte, otherwise the following records will
|
||||
// fail with a LeftOverDataException
|
||||
if (b != 0) {
|
||||
try {
|
||||
in.reset();
|
||||
} catch (IOException e) {
|
||||
throw new RecordFormatException(e);
|
||||
}
|
||||
}
|
||||
field_5_sheetname = IOUtils.safelyAllocate(field_4_sheetname_length, MAX_RECORD_LENGTH);
|
||||
in.read(field_5_sheetname, 0, field_4_sheetname_length);
|
||||
}
|
||||
|
@ -30,15 +30,15 @@ import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.security.Permission;
|
||||
|
||||
import org.apache.poi.EmptyFileException;
|
||||
import org.apache.poi.EncryptedDocumentException;
|
||||
import org.apache.poi.POIDataSamples;
|
||||
import org.apache.poi.hssf.HSSFTestDataSamples;
|
||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||
import org.apache.poi.util.RecordFormatException;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ public final class TestOldExcelExtractor {
|
||||
|
||||
@Test
|
||||
public void testSimpleExcel3() throws IOException {
|
||||
OldExcelExtractor extractor = createExtractor("testEXCEL_3.xls");
|
||||
try (OldExcelExtractor extractor = createExtractor("testEXCEL_3.xls")) {
|
||||
|
||||
// Check we can call getText without error
|
||||
String text = extractor.getText();
|
||||
@ -73,21 +73,20 @@ public final class TestOldExcelExtractor {
|
||||
assertEquals(3, extractor.getBiffVersion());
|
||||
assertEquals(0x10, extractor.getFileType());
|
||||
|
||||
extractor.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSimpleExcel3NoReading() throws IOException {
|
||||
OldExcelExtractor extractor = createExtractor("testEXCEL_3.xls");
|
||||
try (OldExcelExtractor extractor = createExtractor("testEXCEL_3.xls")) {
|
||||
assertNotNull(extractor);
|
||||
|
||||
extractor.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleExcel4() throws IOException {
|
||||
OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls");
|
||||
try (OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls")) {
|
||||
|
||||
// Check we can call getText without error
|
||||
String text = extractor.getText();
|
||||
@ -104,13 +103,13 @@ public final class TestOldExcelExtractor {
|
||||
assertEquals(4, extractor.getBiffVersion());
|
||||
assertEquals(0x10, extractor.getFileType());
|
||||
|
||||
extractor.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleExcel5() throws IOException {
|
||||
for (String ver : new String[] {"5", "95"}) {
|
||||
OldExcelExtractor extractor = createExtractor("testEXCEL_"+ver+".xls");
|
||||
try (OldExcelExtractor extractor = createExtractor("testEXCEL_"+ver+".xls")) {
|
||||
|
||||
// Check we can call getText without error
|
||||
String text = extractor.getText();
|
||||
@ -130,13 +129,13 @@ public final class TestOldExcelExtractor {
|
||||
assertEquals(5, extractor.getBiffVersion());
|
||||
assertEquals(0x05, extractor.getFileType());
|
||||
|
||||
extractor.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStrings() throws IOException {
|
||||
OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls");
|
||||
try (OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls")) {
|
||||
String text = extractor.getText();
|
||||
|
||||
// Simple strings
|
||||
@ -151,13 +150,12 @@ public final class TestOldExcelExtractor {
|
||||
|
||||
// Formula based strings
|
||||
// TODO Find some then test
|
||||
|
||||
extractor.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFormattedNumbersExcel4() throws IOException {
|
||||
OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls");
|
||||
try (OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls")) {
|
||||
String text = extractor.getText();
|
||||
|
||||
// Simple numbers
|
||||
@ -172,14 +170,13 @@ public final class TestOldExcelExtractor {
|
||||
// TODO
|
||||
// assertContains(text, "55,624");
|
||||
// assertContains(text, "11,743,477");
|
||||
|
||||
extractor.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFormattedNumbersExcel5() throws IOException {
|
||||
for (String ver : new String[] {"5", "95"}) {
|
||||
OldExcelExtractor extractor = createExtractor("testEXCEL_"+ver+".xls");
|
||||
try (OldExcelExtractor extractor = createExtractor("testEXCEL_"+ver+".xls")) {
|
||||
String text = extractor.getText();
|
||||
|
||||
// Simple numbers
|
||||
@ -198,8 +195,7 @@ public final class TestOldExcelExtractor {
|
||||
// assertContains(text, "1,234,500");
|
||||
// assertContains(text, "$169.00");
|
||||
// assertContains(text, "$1,253.82");
|
||||
|
||||
extractor.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,12 +205,11 @@ public final class TestOldExcelExtractor {
|
||||
String filename = "testEXCEL_"+ver+".xls";
|
||||
File f = HSSFTestDataSamples.getSampleFile(filename);
|
||||
|
||||
OldExcelExtractor extractor = new OldExcelExtractor(f);
|
||||
try (OldExcelExtractor extractor = new OldExcelExtractor(f)) {
|
||||
String text = extractor.getText();
|
||||
assertNotNull(text);
|
||||
assertTrue(text.length() > 100);
|
||||
|
||||
extractor.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,12 +219,11 @@ public final class TestOldExcelExtractor {
|
||||
String filename = "testEXCEL_"+ver+".xls";
|
||||
File f = HSSFTestDataSamples.getSampleFile(filename);
|
||||
|
||||
try (InputStream stream = new FileInputStream(f)) {
|
||||
OldExcelExtractor extractor = new OldExcelExtractor(stream);
|
||||
try (InputStream stream = new FileInputStream(f);
|
||||
OldExcelExtractor extractor = new OldExcelExtractor(stream)) {
|
||||
String text = extractor.getText();
|
||||
assertNotNull(text);
|
||||
assertTrue(text.length() > 100);
|
||||
extractor.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -237,14 +231,14 @@ public final class TestOldExcelExtractor {
|
||||
@Test(expected=OfficeXmlFileException.class)
|
||||
public void testOpenInvalidFile1() throws IOException {
|
||||
// a file that exists, but is a different format
|
||||
createExtractor("WithVariousData.xlsx");
|
||||
createExtractor("WithVariousData.xlsx").close();
|
||||
}
|
||||
|
||||
|
||||
@Test(expected=RecordFormatException.class)
|
||||
public void testOpenInvalidFile2() throws IOException {
|
||||
// a completely different type of file
|
||||
createExtractor("48936-strings.txt");
|
||||
createExtractor("48936-strings.txt").close();
|
||||
}
|
||||
|
||||
@Test(expected=FileNotFoundException.class)
|
||||
@ -258,71 +252,72 @@ public final class TestOldExcelExtractor {
|
||||
@Test(expected=EmptyFileException.class)
|
||||
public void testOpenNonExistingFile() throws IOException {
|
||||
// a file that exists, but is a different format
|
||||
OldExcelExtractor extractor = new OldExcelExtractor(new File("notexistingfile.xls"));
|
||||
extractor.close();
|
||||
new OldExcelExtractor(new File("notexistingfile.xls")).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInputStream() throws IOException {
|
||||
File file = HSSFTestDataSamples.getSampleFile("testEXCEL_3.xls");
|
||||
try (InputStream stream = new FileInputStream(file)) {
|
||||
OldExcelExtractor extractor = new OldExcelExtractor(stream);
|
||||
try (InputStream stream = new FileInputStream(file);
|
||||
OldExcelExtractor extractor = new OldExcelExtractor(stream);) {
|
||||
String text = extractor.getText();
|
||||
assertNotNull(text);
|
||||
extractor.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInputStreamNPOIHeader() throws IOException {
|
||||
File file = HSSFTestDataSamples.getSampleFile("FormulaRefs.xls");
|
||||
try (InputStream stream = new FileInputStream(file)) {
|
||||
OldExcelExtractor extractor = new OldExcelExtractor(stream);
|
||||
extractor.close();
|
||||
try (InputStream stream = new FileInputStream(file);
|
||||
OldExcelExtractor extractor = new OldExcelExtractor(stream)) {
|
||||
String text = extractor.getText();
|
||||
assertNotNull(text);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPOIFSFileSystem() throws IOException {
|
||||
File file = HSSFTestDataSamples.getSampleFile("FormulaRefs.xls");
|
||||
try (POIFSFileSystem fs = new POIFSFileSystem(file)) {
|
||||
OldExcelExtractor extractor = new OldExcelExtractor(fs);
|
||||
extractor.close();
|
||||
try (POIFSFileSystem fs = new POIFSFileSystem(file);
|
||||
OldExcelExtractor extractor = new OldExcelExtractor(fs)){
|
||||
String text = extractor.getText();
|
||||
assertNotNull(text);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDirectoryNode() throws IOException {
|
||||
File file = HSSFTestDataSamples.getSampleFile("FormulaRefs.xls");
|
||||
try (POIFSFileSystem fs = new POIFSFileSystem(file)) {
|
||||
OldExcelExtractor extractor = new OldExcelExtractor(fs.getRoot());
|
||||
extractor.close();
|
||||
try (POIFSFileSystem fs = new POIFSFileSystem(file);
|
||||
OldExcelExtractor extractor = new OldExcelExtractor(fs.getRoot())) {
|
||||
String text = extractor.getText();
|
||||
assertNotNull(text);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(expected = FileNotFoundException.class)
|
||||
public void testDirectoryNodeInvalidFile() throws IOException {
|
||||
File file = POIDataSamples.getDocumentInstance().getFile("test.doc");
|
||||
try (POIFSFileSystem fs = new POIFSFileSystem(file)) {
|
||||
OldExcelExtractor extractor = new OldExcelExtractor(fs.getRoot());
|
||||
extractor.close();
|
||||
fail("Should catch exception here");
|
||||
} catch (FileNotFoundException e) {
|
||||
// expected here
|
||||
try (POIFSFileSystem fs = new POIFSFileSystem(file);
|
||||
OldExcelExtractor extractor = new OldExcelExtractor(fs.getRoot())) {
|
||||
fail("Should throw exception here");
|
||||
}
|
||||
}
|
||||
|
||||
@Ignore("Calls System.exit()")
|
||||
@Test
|
||||
@Test(expected = ExitException.class)
|
||||
public void testMainUsage() throws IOException {
|
||||
PrintStream save = System.err;
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
System.setSecurityManager(new NoExitSecurityManager());
|
||||
try {
|
||||
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||
PrintStream str = new PrintStream(out, false, "UTF-8");
|
||||
System.setErr(str);
|
||||
// calls System.exit()
|
||||
OldExcelExtractor.main(new String[]{});
|
||||
}
|
||||
} finally {
|
||||
System.setSecurityManager(sm);
|
||||
System.setErr(save);
|
||||
}
|
||||
}
|
||||
@ -333,34 +328,49 @@ public final class TestOldExcelExtractor {
|
||||
PrintStream save = System.out;
|
||||
try {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
try {
|
||||
PrintStream str = new PrintStream(out, false, "UTF-8");
|
||||
System.setOut(str);
|
||||
OldExcelExtractor.main(new String[] {file.getAbsolutePath()});
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
String string = out.toString("UTF-8");
|
||||
assertTrue("Had: " + string,
|
||||
string.contains("Table C-13--Lemons"));
|
||||
assertTrue("Had: " + string, string.contains("Table C-13--Lemons"));
|
||||
} finally {
|
||||
System.setOut(save);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(expected = EncryptedDocumentException.class)
|
||||
public void testEncryptionException() throws IOException {
|
||||
//test file derives from Common Crawl
|
||||
File file = HSSFTestDataSamples.getSampleFile("60284.xls");
|
||||
OldExcelExtractor ex = new OldExcelExtractor(file);
|
||||
|
||||
try (OldExcelExtractor ex = new OldExcelExtractor(file)) {
|
||||
assertEquals(5, ex.getBiffVersion());
|
||||
assertEquals(5, ex.getFileType());
|
||||
try {
|
||||
ex.getText();
|
||||
fail();
|
||||
} catch (EncryptedDocumentException e) {
|
||||
assertTrue("correct exception thrown", true);
|
||||
}
|
||||
ex.close();
|
||||
}
|
||||
}
|
||||
|
||||
private static class NoExitSecurityManager extends SecurityManager {
|
||||
@Override
|
||||
public void checkPermission(Permission perm) {
|
||||
// allow anything.
|
||||
}
|
||||
@Override
|
||||
public void checkPermission(Permission perm, Object context) {
|
||||
// allow anything.
|
||||
}
|
||||
@Override
|
||||
public void checkExit(int status) {
|
||||
super.checkExit(status);
|
||||
throw new ExitException(status);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ExitException extends SecurityException {
|
||||
public final int status;
|
||||
public ExitException(int status) {
|
||||
super("There is no escape!");
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,10 +27,8 @@ import static org.junit.Assert.fail;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -178,12 +176,7 @@ public class TestDrawingAggregate {
|
||||
@Test
|
||||
public void testAllTestSamples() throws IOException {
|
||||
File[] xls = new File(System.getProperty("POI.testdata.path"), "spreadsheet").listFiles(
|
||||
new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.endsWith(".xls");
|
||||
}
|
||||
}
|
||||
(dir, name) -> name.endsWith(".xls")
|
||||
);
|
||||
assertNotNull(
|
||||
"Need to find files in test-data path, had path: " + new File(System.getProperty("POI.testdata.path"), "spreadsheet"),
|
||||
@ -246,12 +239,17 @@ public class TestDrawingAggregate {
|
||||
*/
|
||||
@Test
|
||||
public void testFailing() throws IOException {
|
||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("15573.xls");
|
||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("15573.xls")) {
|
||||
HSSFSheet sh = wb.getSheetAt(0);
|
||||
sh.getDrawingPatriarch();
|
||||
HSSFPatriarch dp = sh.getDrawingPatriarch();
|
||||
assertNotNull(dp);
|
||||
|
||||
HSSFTestDataSamples.writeOutAndReadBack(wb).close();
|
||||
wb.close();
|
||||
try (HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb)) {
|
||||
HSSFSheet sh2 = wb2.getSheetAt(0);
|
||||
HSSFPatriarch dp2 = sh2.getDrawingPatriarch();
|
||||
assertNotNull(dp2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] toByteArray(List<RecordBase> records) {
|
||||
@ -269,7 +267,7 @@ public class TestDrawingAggregate {
|
||||
|
||||
@Test
|
||||
public void testSolverContainerMustBeSavedDuringSerialization() throws IOException{
|
||||
HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("SolverContainerAfterSPGR.xls");
|
||||
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("SolverContainerAfterSPGR.xls")) {
|
||||
HSSFSheet sh = wb1.getSheetAt(0);
|
||||
InternalSheet ish = HSSFTestHelper.getSheetForTest(sh);
|
||||
List<RecordBase> records = ish.getRecords();
|
||||
@ -278,29 +276,32 @@ public class TestDrawingAggregate {
|
||||
byte[] dgBytes = toByteArray(dgRecords);
|
||||
sh.getDrawingPatriarch();
|
||||
EscherAggregate agg = (EscherAggregate) ish.findFirstRecordBySid(EscherAggregate.sid);
|
||||
assertNotNull(agg);
|
||||
assertEquals(agg.getEscherRecords().get(0).getChildRecords().size(), 3);
|
||||
assertEquals(agg.getEscherRecords().get(0).getChild(2).getRecordId(), EscherContainerRecord.SOLVER_CONTAINER);
|
||||
HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb1);
|
||||
wb1.close();
|
||||
try (HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb1)) {
|
||||
sh = wb2.getSheetAt(0);
|
||||
sh.getDrawingPatriarch();
|
||||
ish = HSSFTestHelper.getSheetForTest(sh);
|
||||
agg = (EscherAggregate) ish.findFirstRecordBySid(EscherAggregate.sid);
|
||||
assertNotNull(agg);
|
||||
assertEquals(agg.getEscherRecords().get(0).getChildRecords().size(), 3);
|
||||
assertEquals(agg.getEscherRecords().get(0).getChild(2).getRecordId(), EscherContainerRecord.SOLVER_CONTAINER);
|
||||
|
||||
|
||||
// collect drawing records into a byte buffer.
|
||||
agg = (EscherAggregate) ish.findFirstRecordBySid(EscherAggregate.sid);
|
||||
assertNotNull(agg);
|
||||
byte[] dgBytesAfterSave = agg.serialize();
|
||||
assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
|
||||
assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
|
||||
wb2.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFileWithTextbox() throws IOException{
|
||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("text.xls");
|
||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("text.xls")) {
|
||||
HSSFSheet sh = wb.getSheetAt(0);
|
||||
InternalSheet ish = HSSFTestHelper.getSheetForTest(sh);
|
||||
List<RecordBase> records = ish.getRecords();
|
||||
@ -311,15 +312,16 @@ public class TestDrawingAggregate {
|
||||
|
||||
// collect drawing records into a byte buffer.
|
||||
EscherAggregate agg = (EscherAggregate) ish.findFirstRecordBySid(EscherAggregate.sid);
|
||||
assertNotNull(agg);
|
||||
byte[] dgBytesAfterSave = agg.serialize();
|
||||
assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
|
||||
assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
|
||||
wb.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFileWithCharts() throws IOException {
|
||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("49581.xls");
|
||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("49581.xls")) {
|
||||
HSSFSheet sh = wb.getSheetAt(0);
|
||||
InternalSheet ish = HSSFTestHelper.getSheetForTest(sh);
|
||||
List<RecordBase> records = ish.getRecords();
|
||||
@ -330,6 +332,7 @@ public class TestDrawingAggregate {
|
||||
|
||||
// collect drawing records into a byte buffer.
|
||||
EscherAggregate agg = (EscherAggregate) ish.findFirstRecordBySid(EscherAggregate.sid);
|
||||
assertNotNull(agg);
|
||||
byte[] dgBytesAfterSave = agg.serialize();
|
||||
assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
|
||||
for (int i = 0; i < dgBytes.length; i++) {
|
||||
@ -338,7 +341,7 @@ public class TestDrawingAggregate {
|
||||
}
|
||||
}
|
||||
assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
|
||||
wb.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -346,7 +349,7 @@ public class TestDrawingAggregate {
|
||||
*/
|
||||
@Test
|
||||
public void test45129() throws IOException {
|
||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("45129.xls");
|
||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("45129.xls")) {
|
||||
HSSFSheet sh = wb.getSheetAt(0);
|
||||
|
||||
InternalWorkbook iworkbook = HSSFTestHelper.getWorkbookForTest(wb);
|
||||
@ -401,7 +404,7 @@ public class TestDrawingAggregate {
|
||||
byte[] dgBytesAfterSave = agg.serialize();
|
||||
assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
|
||||
assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
|
||||
wb.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -414,7 +417,7 @@ public class TestDrawingAggregate {
|
||||
*/
|
||||
@Test
|
||||
public void testSerializeDrawingBigger8k() throws IOException {
|
||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("DrawingContinue.xls");
|
||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("DrawingContinue.xls")) {
|
||||
InternalWorkbook iworkbook = HSSFTestHelper.getWorkbookForTest(wb);
|
||||
HSSFSheet sh = wb.getSheetAt(0);
|
||||
InternalSheet isheet = HSSFTestHelper.getSheetForTest(sh);
|
||||
@ -469,19 +472,17 @@ public class TestDrawingAggregate {
|
||||
byte[] dgBytesAfterSave = agg.serialize();
|
||||
assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
|
||||
assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
|
||||
wb.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSerializeDrawingBigger8k_noAggregation() throws IOException {
|
||||
HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("DrawingContinue.xls");
|
||||
|
||||
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("DrawingContinue.xls")) {
|
||||
InternalSheet isheet = HSSFTestHelper.getSheetForTest(wb1.getSheetAt(0));
|
||||
List<RecordBase> records = isheet.getRecords();
|
||||
|
||||
HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb1);
|
||||
wb1.close();
|
||||
try (HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb1)) {
|
||||
InternalSheet isheet2 = HSSFTestHelper.getSheetForTest(wb2.getSheetAt(0));
|
||||
List<RecordBase> records2 = isheet2.getRecords();
|
||||
|
||||
@ -496,12 +497,13 @@ public class TestDrawingAggregate {
|
||||
assertArrayEquals(((Record) r1).serialize(), ((Record) r2).serialize());
|
||||
}
|
||||
}
|
||||
wb2.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSerializeDrawingWithComments() throws IOException {
|
||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("DrawingAndComments.xls");
|
||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("DrawingAndComments.xls")) {
|
||||
HSSFSheet sh = wb.getSheetAt(0);
|
||||
InternalWorkbook iworkbook = HSSFTestHelper.getWorkbookForTest(wb);
|
||||
InternalSheet isheet = HSSFTestHelper.getSheetForTest(sh);
|
||||
@ -555,13 +557,13 @@ public class TestDrawingAggregate {
|
||||
byte[] dgBytesAfterSave = agg.serialize();
|
||||
assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
|
||||
assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
|
||||
wb.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testFileWithPictures() throws IOException {
|
||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ContinueRecordProblem.xls");
|
||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ContinueRecordProblem.xls")) {
|
||||
HSSFSheet sh = wb.getSheetAt(0);
|
||||
|
||||
InternalWorkbook iworkbook = HSSFTestHelper.getWorkbookForTest(wb);
|
||||
@ -615,7 +617,7 @@ public class TestDrawingAggregate {
|
||||
byte[] dgBytesAfterSave = agg.serialize();
|
||||
assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
|
||||
assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
|
||||
wb.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -17,7 +17,11 @@
|
||||
|
||||
package org.apache.poi.hssf.model;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
@ -37,45 +41,10 @@ import org.apache.poi.ss.formula.FormulaParseException;
|
||||
import org.apache.poi.ss.formula.FormulaParser;
|
||||
import org.apache.poi.ss.formula.FormulaType;
|
||||
import org.apache.poi.ss.formula.constant.ErrorConstant;
|
||||
import org.apache.poi.ss.formula.ptg.AbstractFunctionPtg;
|
||||
import org.apache.poi.ss.formula.ptg.AddPtg;
|
||||
import org.apache.poi.ss.formula.ptg.Area3DPtg;
|
||||
import org.apache.poi.ss.formula.ptg.AreaI;
|
||||
import org.apache.poi.ss.formula.ptg.AreaPtg;
|
||||
import org.apache.poi.ss.formula.ptg.AreaPtgBase;
|
||||
import org.apache.poi.ss.formula.ptg.ArrayPtg;
|
||||
import org.apache.poi.ss.formula.ptg.AttrPtg;
|
||||
import org.apache.poi.ss.formula.ptg.BoolPtg;
|
||||
import org.apache.poi.ss.formula.ptg.ConcatPtg;
|
||||
import org.apache.poi.ss.formula.ptg.DividePtg;
|
||||
import org.apache.poi.ss.formula.ptg.EqualPtg;
|
||||
import org.apache.poi.ss.formula.ptg.ErrPtg;
|
||||
import org.apache.poi.ss.formula.ptg.FuncPtg;
|
||||
import org.apache.poi.ss.formula.ptg.FuncVarPtg;
|
||||
import org.apache.poi.ss.formula.ptg.GreaterThanPtg;
|
||||
import org.apache.poi.ss.formula.ptg.IntPtg;
|
||||
import org.apache.poi.ss.formula.ptg.IntersectionPtg;
|
||||
import org.apache.poi.ss.formula.ptg.MemAreaPtg;
|
||||
import org.apache.poi.ss.formula.ptg.MemFuncPtg;
|
||||
import org.apache.poi.ss.formula.ptg.MissingArgPtg;
|
||||
import org.apache.poi.ss.formula.ptg.MultiplyPtg;
|
||||
import org.apache.poi.ss.formula.ptg.NamePtg;
|
||||
import org.apache.poi.ss.formula.ptg.NameXPtg;
|
||||
import org.apache.poi.ss.formula.ptg.NumberPtg;
|
||||
import org.apache.poi.ss.formula.ptg.ParenthesisPtg;
|
||||
import org.apache.poi.ss.formula.ptg.PercentPtg;
|
||||
import org.apache.poi.ss.formula.ptg.PowerPtg;
|
||||
import org.apache.poi.ss.formula.ptg.Ptg;
|
||||
import org.apache.poi.ss.formula.ptg.RangePtg;
|
||||
import org.apache.poi.ss.formula.ptg.Ref3DPtg;
|
||||
import org.apache.poi.ss.formula.ptg.RefPtg;
|
||||
import org.apache.poi.ss.formula.ptg.StringPtg;
|
||||
import org.apache.poi.ss.formula.ptg.SubtractPtg;
|
||||
import org.apache.poi.ss.formula.ptg.UnaryMinusPtg;
|
||||
import org.apache.poi.ss.formula.ptg.UnaryPlusPtg;
|
||||
import org.apache.poi.ss.formula.ptg.UnionPtg;
|
||||
import org.apache.poi.ss.formula.ptg.*;
|
||||
import org.apache.poi.ss.usermodel.BaseTestBugzillaIssues;
|
||||
import org.apache.poi.ss.usermodel.FormulaError;
|
||||
import org.apache.poi.ss.usermodel.FormulaEvaluator;
|
||||
import org.apache.poi.ss.usermodel.Name;
|
||||
import org.apache.poi.util.HexRead;
|
||||
import org.apache.poi.util.LittleEndianByteArrayInputStream;
|
||||
@ -230,22 +199,30 @@ public final class TestFormulaParser {
|
||||
|
||||
@Test
|
||||
public void testWorksheetReferences() throws IOException {
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
||||
|
||||
wb.createSheet("NoQuotesNeeded");
|
||||
wb.createSheet("Quotes Needed Here &#$@");
|
||||
HSSFSheet sheet1 = wb.createSheet("NoQuotesNeeded");
|
||||
sheet1.createRow(0).createCell(0).setCellValue("NoQuotesNeeded");
|
||||
HSSFSheet sheet2 = wb.createSheet("Quotes Needed Here &#$@");
|
||||
sheet2.createRow(0).createCell(0).setCellValue("Quotes Needed Here &#$@");
|
||||
|
||||
HSSFSheet sheet = wb.createSheet("Test");
|
||||
HSSFRow row = sheet.createRow(0);
|
||||
|
||||
FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
|
||||
HSSFCell cell;
|
||||
String act;
|
||||
|
||||
cell = row.createCell(0);
|
||||
cell.setCellFormula("NoQuotesNeeded!A1");
|
||||
act = evaluator.evaluate(cell).getStringValue();
|
||||
assertEquals("NoQuotesNeeded", act);
|
||||
|
||||
cell = row.createCell(1);
|
||||
cell.setCellFormula("'Quotes Needed Here &#$@'!A1");
|
||||
|
||||
wb.close();
|
||||
act = evaluator.evaluate(cell).getStringValue();
|
||||
assertEquals("Quotes Needed Here &#$@", act);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -330,9 +307,9 @@ public final class TestFormulaParser {
|
||||
/** bug 35027, underscore in sheet name */
|
||||
@Test
|
||||
public void testUnderscore() throws IOException {
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
|
||||
wb.createSheet("Cash_Flow");
|
||||
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
||||
HSSFSheet sheet1 = wb.createSheet("Cash_Flow");
|
||||
sheet1.createRow(0).createCell(0).setCellValue("Cash_Flow");
|
||||
|
||||
HSSFSheet sheet = wb.createSheet("Test");
|
||||
HSSFRow row = sheet.createRow(0);
|
||||
@ -341,7 +318,10 @@ public final class TestFormulaParser {
|
||||
cell = row.createCell(0);
|
||||
cell.setCellFormula("Cash_Flow!A1");
|
||||
|
||||
wb.close();
|
||||
FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
|
||||
String act = evaluator.evaluate(cell).getStringValue();
|
||||
assertEquals("Cash_Flow", act);
|
||||
}
|
||||
}
|
||||
|
||||
/** bug 49725, defined names with underscore */
|
||||
|
@ -202,15 +202,15 @@ public final class TestSheet {
|
||||
assertEquals("Should be no more merged regions", 0, sheet.getNumMergedRegions());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMergedRegionAt() {
|
||||
// @Test
|
||||
// public void testGetMergedRegionAt() {
|
||||
// TODO
|
||||
}
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testGetNumMergedRegions() {
|
||||
// @Test
|
||||
// public void testGetNumMergedRegions() {
|
||||
// TODO
|
||||
}
|
||||
// }
|
||||
|
||||
/**
|
||||
* Makes sure all rows registered for this sheet are aggregated, they were being skipped
|
||||
|
@ -17,17 +17,25 @@
|
||||
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.poi.hssf.HSSFTestDataSamples;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.junit.Test;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
public final class TestBOFRecord {
|
||||
@Test
|
||||
public void testBOFRecord() throws IOException {
|
||||
// This used to throw an error before - #42794
|
||||
HSSFTestDataSamples.openSampleWorkbook("bug_42794.xls").close();
|
||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("bug_42794.xls")) {
|
||||
Sheet sh = wb.getSheetAt(0);
|
||||
for (int i=1; i<=10; i++) {
|
||||
double act = sh.getRow(i).getCell(0).getNumericCellValue();
|
||||
assertEquals(i, act, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ public final class TestCFRuleRecord {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testCreateCFRuleRecord() throws IOException {
|
||||
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
||||
@ -96,6 +97,7 @@ public final class TestCFRuleRecord {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testCreateCFRule12Record() throws IOException {
|
||||
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
||||
@ -422,7 +424,7 @@ public final class TestCFRuleRecord {
|
||||
assertTrue(refNPtg.isRowRelative());
|
||||
|
||||
byte[] data = rr.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(CFRuleRecord.sid, DATA_REFN, data);
|
||||
confirmRecordEncoding(CFRuleRecord.sid, DATA_REFN, data);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -56,6 +56,7 @@ public final class TestCommonObjectDataSubRecord {
|
||||
assertEquals(18, record.getDataSize());
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
CommonObjectDataSubRecord record = new CommonObjectDataSubRecord();
|
||||
|
@ -72,6 +72,7 @@ public final class TestEmbeddedObjectRefSubRecord {
|
||||
assertArrayEquals(ser, ser2);
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testCameraTool_bug45912() {
|
||||
/*
|
||||
@ -95,6 +96,7 @@ public final class TestEmbeddedObjectRefSubRecord {
|
||||
/**
|
||||
* tests various examples of OLE controls
|
||||
*/
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testVarious() {
|
||||
String[] rawData = {
|
||||
@ -125,9 +127,10 @@ public final class TestEmbeddedObjectRefSubRecord {
|
||||
|
||||
EmbeddedObjectRefSubRecord rec = new EmbeddedObjectRefSubRecord(in, data.length);
|
||||
byte[] ser2 = rec.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding("Test record " + i, EORSR_SID, data, ser2);
|
||||
confirmRecordEncoding("Test record " + i, EORSR_SID, data, ser2);
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testVisioDrawing_bug46199() {
|
||||
/*
|
||||
@ -146,6 +149,6 @@ public final class TestEmbeddedObjectRefSubRecord {
|
||||
// bug 22860 - Not enough data (3) to read requested (4) bytes
|
||||
EmbeddedObjectRefSubRecord rec = new EmbeddedObjectRefSubRecord(in, data46199.length);
|
||||
byte[] ser2 = rec.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(EORSR_SID, data46199, ser2);
|
||||
confirmRecordEncoding(EORSR_SID, data46199, ser2);
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ public final class TestExtendedFormatRecord {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
// .fontindex = 0
|
||||
@ -122,6 +123,7 @@ public final class TestExtendedFormatRecord {
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testCloneOnto() {
|
||||
ExtendedFormatRecord base = createEFR();
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
@ -57,7 +58,7 @@ public final class TestExternalNameRecord {
|
||||
assertEquals("FDS", enr.getText());
|
||||
|
||||
// bug 44695
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(0x0023, dataFDS, enr.serialize());
|
||||
confirmRecordEncoding(0x0023, dataFDS, enr.serialize());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -81,7 +82,7 @@ public final class TestExternalNameRecord {
|
||||
assertFalse(enr.isPicureLink());
|
||||
assertTrue(enr.isStdDocumentNameIdentifier());
|
||||
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(0x0023, dataAutoDocName, enr.serialize());
|
||||
confirmRecordEncoding(0x0023, dataAutoDocName, enr.serialize());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -96,7 +97,7 @@ public final class TestExternalNameRecord {
|
||||
assertFalse(enr.isPicureLink());
|
||||
assertFalse(enr.isStdDocumentNameIdentifier());
|
||||
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(0x0023, dataPlainName, enr.serialize());
|
||||
confirmRecordEncoding(0x0023, dataPlainName, enr.serialize());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -121,7 +122,7 @@ public final class TestExternalNameRecord {
|
||||
ExternalNameRecord enr = createSimpleENR(dataDDE);
|
||||
assertEquals("010672AT0 MUNI,[RTG_MOODY_UNDERLYING,RTG_SP_UNDERLYING]", enr.getText());
|
||||
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(0x0023, dataDDE, enr.serialize());
|
||||
confirmRecordEncoding(0x0023, dataDDE, enr.serialize());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -18,6 +18,7 @@
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
|
||||
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
@ -67,6 +68,7 @@ public final class TestFontRecord {
|
||||
assertEquals(21 + 4, record.getRecordSize());
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
// .fontheight = c8
|
||||
@ -96,7 +98,7 @@ public final class TestFontRecord {
|
||||
record.setFontName("Arial");
|
||||
|
||||
byte [] recordBytes = record.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(0x31, data, recordBytes);
|
||||
confirmRecordEncoding(0x31, data, recordBytes);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -150,6 +152,6 @@ public final class TestFontRecord {
|
||||
|
||||
assertEquals(0, fr.getFontName().length());
|
||||
byte[] recordBytes = fr.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(SID, emptyNameData, recordBytes);
|
||||
confirmRecordEncoding(SID, emptyNameData, recordBytes);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
==================================================================== */
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
@ -453,12 +454,13 @@ public final class TestHyperlinkRecord {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testReserializeTargetFrame() {
|
||||
RecordInputStream in = TestcaseRecordInputStream.create(HyperlinkRecord.sid, dataTargetFrame);
|
||||
HyperlinkRecord hr = new HyperlinkRecord(in);
|
||||
byte[] ser = hr.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(HyperlinkRecord.sid, dataTargetFrame, ser);
|
||||
confirmRecordEncoding(HyperlinkRecord.sid, dataTargetFrame, ser);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -467,7 +469,7 @@ public final class TestHyperlinkRecord {
|
||||
RecordInputStream in = TestcaseRecordInputStream.create(HyperlinkRecord.sid, dataLinkToWorkbook);
|
||||
HyperlinkRecord hr = new HyperlinkRecord(in);
|
||||
byte[] ser = hr.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(HyperlinkRecord.sid, dataLinkToWorkbook, ser);
|
||||
confirmRecordEncoding(HyperlinkRecord.sid, dataLinkToWorkbook, ser);
|
||||
assertNotEquals("Identified bug in reading workbook link", "YEARFR~1.XLS", hr.getAddress());
|
||||
assertEquals("yearfracExamples.xls", hr.getAddress());
|
||||
}
|
||||
@ -478,7 +480,7 @@ public final class TestHyperlinkRecord {
|
||||
RecordInputStream in = TestcaseRecordInputStream.create(HyperlinkRecord.sid, dataUNC);
|
||||
HyperlinkRecord hr = new HyperlinkRecord(in);
|
||||
byte[] ser = hr.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(HyperlinkRecord.sid, dataUNC, ser);
|
||||
confirmRecordEncoding(HyperlinkRecord.sid, dataUNC, ser);
|
||||
assertNotNull(hr.toString());
|
||||
}
|
||||
|
||||
@ -541,6 +543,6 @@ public final class TestHyperlinkRecord {
|
||||
assertEquals("testfolder/test.PDF", link.getAddress());
|
||||
|
||||
byte[] ser = link.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(HyperlinkRecord.sid, data_47498, ser);
|
||||
confirmRecordEncoding(HyperlinkRecord.sid, data_47498, ser);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
|
||||
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
@ -71,7 +72,7 @@ public final class TestLbsDataSubRecord {
|
||||
|
||||
// check that it re-serializes to the same data
|
||||
byte[] ser = record.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(ObjRecord.sid, data, ser);
|
||||
confirmRecordEncoding(ObjRecord.sid, data, ser);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,7 +110,7 @@ public final class TestLbsDataSubRecord {
|
||||
|
||||
// check that it re-serializes to the same data
|
||||
byte[] ser = record.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(ObjRecord.sid, data, ser);
|
||||
confirmRecordEncoding(ObjRecord.sid, data, ser);
|
||||
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.apache.poi.util.HexRead;
|
||||
@ -37,6 +38,6 @@ public final class TestNameCommentRecord {
|
||||
assertEquals("name", ncr.getNameText());
|
||||
assertEquals("comment", ncr.getCommentText());
|
||||
final byte[] data2 = ncr.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(NameCommentRecord.sid, data, data2);
|
||||
confirmRecordEncoding(NameCommentRecord.sid, data, data2);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
@ -68,7 +69,7 @@ public final class TestNameRecord {
|
||||
NameRecord nr = new NameRecord(in);
|
||||
assertEquals(0x0020, nr.getOptionFlag());
|
||||
byte[] data2 = nr.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(NameRecord.sid, data, data2);
|
||||
confirmRecordEncoding(NameRecord.sid, data, data2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
@ -64,7 +65,7 @@ public final class TestNoteRecord {
|
||||
record.setAuthor("Apache Software Foundation");
|
||||
|
||||
byte[] ser = record.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(NoteRecord.sid, testData, ser);
|
||||
confirmRecordEncoding(NoteRecord.sid, testData, ser);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -107,7 +108,7 @@ public final class TestNoteRecord {
|
||||
assertTrue(nr.authorIsMultibyte());
|
||||
|
||||
byte[] ser = nr.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(NoteRecord.sid, data, ser);
|
||||
confirmRecordEncoding(NoteRecord.sid, data, ser);
|
||||
|
||||
// Re-check
|
||||
in = TestcaseRecordInputStream.create(ser);
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@ -129,6 +130,7 @@ public final class TestObjRecord {
|
||||
* Check that ObjRecord tolerates and preserves padding to a 4-byte boundary
|
||||
* (normally padding is to a 2-byte boundary).
|
||||
*/
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void test4BytePadding() {
|
||||
// actual data from file saved by Excel 2007
|
||||
@ -142,6 +144,6 @@ public final class TestObjRecord {
|
||||
ObjRecord record = new ObjRecord(in);
|
||||
// check that it re-serializes to the same data
|
||||
byte[] ser = record.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(ObjRecord.sid, data, ser);
|
||||
confirmRecordEncoding(ObjRecord.sid, data, ser);
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ public final class TestPaneRecord {
|
||||
assertEquals( 14, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
PaneRecord record = new PaneRecord();
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@ -32,6 +33,7 @@ public final class TestRecalcIdRecord {
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testBasicDeserializeReserialize() {
|
||||
|
||||
@ -41,7 +43,7 @@ public final class TestRecalcIdRecord {
|
||||
"1D EB 01 00"); // engine id
|
||||
|
||||
RecalcIdRecord r = create(data);
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(RecalcIdRecord.sid, data, r.serialize());
|
||||
confirmRecordEncoding(RecalcIdRecord.sid, data, r.serialize());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -42,6 +42,7 @@ public final class TestSCLRecord {
|
||||
assertEquals( 8, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
SCLRecord record = new SCLRecord();
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.apache.poi.util.HexRead;
|
||||
@ -35,6 +36,6 @@ public final class TestStyleRecord {
|
||||
assertEquals("\u5E38\u89C4_Sheet1", sr.getName()); // "<Conventional>_Sheet1"
|
||||
// bug 46385 - Incorrect number of bytes written - expected 27 but got 18
|
||||
byte[] ser = sr.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(StyleRecord.sid, data, ser);
|
||||
confirmRecordEncoding(StyleRecord.sid, data, ser);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
|
||||
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
@ -141,6 +142,6 @@ public final class TestSubRecord {
|
||||
ObjRecord or = new ObjRecord(in);
|
||||
// make sure POI properly truncates the ObjRecord data
|
||||
byte[] data2 = or.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(ObjRecord.sid, data, data2);
|
||||
confirmRecordEncoding(ObjRecord.sid, data, data2);
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import static org.apache.poi.hssf.record.SupBookRecord.CH_STARTUP_DIR;
|
||||
import static org.apache.poi.hssf.record.SupBookRecord.CH_UP_DIR;
|
||||
import static org.apache.poi.hssf.record.SupBookRecord.CH_VOLUME;
|
||||
import static org.apache.poi.hssf.record.SupBookRecord.PATH_SEPERATOR;
|
||||
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@ -99,20 +100,22 @@ public final class TestSupBookRecord {
|
||||
/**
|
||||
* Tests that we can store the record
|
||||
*/
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStoreIR() {
|
||||
SupBookRecord record = SupBookRecord.createInternalReferences((short)4);
|
||||
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(0x01AE, dataIR, record.serialize());
|
||||
confirmRecordEncoding(0x01AE, dataIR, record.serialize());
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStoreER() {
|
||||
String url = "testURL";
|
||||
String[] sheetNames = { "Sheet1", "Sheet2", };
|
||||
SupBookRecord record = SupBookRecord.createExternalReferences(url, sheetNames);
|
||||
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(0x01AE, dataER, record.serialize());
|
||||
confirmRecordEncoding(0x01AE, dataER, record.serialize());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -120,7 +123,7 @@ public final class TestSupBookRecord {
|
||||
SupBookRecord record = SupBookRecord.createAddInFunctions();
|
||||
assertEquals(1, record.getNumberOfSheets());
|
||||
assertTrue(record.isAddInFunctions());
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(0x01AE, dataAIF, record.serialize());
|
||||
confirmRecordEncoding(0x01AE, dataAIF, record.serialize());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -63,6 +63,7 @@ public final class TestTableRecord {
|
||||
assertEquals( 16 + 4, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore()
|
||||
{
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.poi.hssf.record;
|
||||
|
||||
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.apache.poi.util.HexRead;
|
||||
@ -61,7 +62,7 @@ public final class TestWriteAccessRecord {
|
||||
+ "20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 "
|
||||
+ HEX_SIXTYFOUR_SPACES);
|
||||
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(WriteAccessRecord.sid, expectedEncoding, rec.serialize());
|
||||
confirmRecordEncoding(WriteAccessRecord.sid, expectedEncoding, rec.serialize());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -90,6 +91,6 @@ public final class TestWriteAccessRecord {
|
||||
+ "20 20 20 20 20 20 20 20 20 20 20 "
|
||||
+ HEX_SIXTYFOUR_SPACES);
|
||||
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(WriteAccessRecord.sid, expectedEncoding, rec.serialize());
|
||||
confirmRecordEncoding(WriteAccessRecord.sid, expectedEncoding, rec.serialize());
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ public final class TestAreaFormatRecord {
|
||||
assertEquals( 20, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
AreaFormatRecord record = new AreaFormatRecord();
|
||||
|
@ -48,6 +48,7 @@ public final class TestAreaRecord {
|
||||
assertEquals( 6, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
AreaRecord record = new AreaRecord();
|
||||
|
@ -42,6 +42,7 @@ public final class TestAxisLineFormatRecord {
|
||||
assertEquals( 6, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
AxisLineFormatRecord record = new AxisLineFormatRecord();
|
||||
|
@ -63,6 +63,7 @@ public final class TestAxisOptionsRecord {
|
||||
assertEquals( 22, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
AxisOptionsRecord record = new AxisOptionsRecord();
|
||||
|
@ -50,6 +50,7 @@ public final class TestAxisParentRecord {
|
||||
assertEquals( 22, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
AxisParentRecord record = new AxisParentRecord();
|
||||
|
@ -50,6 +50,7 @@ public final class TestAxisRecord {
|
||||
assertEquals( 4 + 18, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
AxisRecord record = new AxisRecord();
|
||||
|
@ -42,6 +42,7 @@ public final class TestAxisUsedRecord {
|
||||
assertEquals( 6, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
AxisUsedRecord record = new AxisUsedRecord();
|
||||
|
@ -51,6 +51,7 @@ public final class TestBarRecord {
|
||||
assertEquals( 10, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
BarRecord record = new BarRecord();
|
||||
|
@ -53,6 +53,7 @@ public final class TestCategorySeriesAxisRecord {
|
||||
assertEquals( 4 + 8, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
CategorySeriesAxisRecord record = new CategorySeriesAxisRecord();
|
||||
|
@ -48,6 +48,7 @@ public final class TestChartRecord {
|
||||
assertEquals( 20, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
ChartRecord record = new ChartRecord();
|
||||
@ -56,7 +57,6 @@ public final class TestChartRecord {
|
||||
record.setWidth( 30474216 );
|
||||
record.setHeight( 15060168 );
|
||||
|
||||
|
||||
byte [] recordBytes = record.serialize();
|
||||
confirmRecordEncoding(ChartRecord.sid, data, recordBytes);
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ public final class TestDatRecord {
|
||||
assertEquals( 6, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
DatRecord record = new DatRecord();
|
||||
@ -56,7 +57,6 @@ public final class TestDatRecord {
|
||||
record.setBorder( true );
|
||||
record.setShowSeriesKey( true );
|
||||
|
||||
|
||||
byte [] recordBytes = record.serialize();
|
||||
confirmRecordEncoding(DatRecord.sid, data, recordBytes);
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ public final class TestDataFormatRecord {
|
||||
assertEquals( 12, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
DataFormatRecord record = new DataFormatRecord();
|
||||
|
@ -43,6 +43,7 @@ public final class TestDefaultDataLabelTextPropertiesRecord {
|
||||
assertEquals( 6, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
DefaultDataLabelTextPropertiesRecord record = new DefaultDataLabelTextPropertiesRecord();
|
||||
|
@ -50,6 +50,7 @@ public final class TestFontBasisRecord {
|
||||
assertEquals( 14, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
FontBasisRecord record = new FontBasisRecord();
|
||||
|
@ -43,6 +43,7 @@ public final class TestFontIndexRecord {
|
||||
assertEquals( 6, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
FontIndexRecord record = new FontIndexRecord();
|
||||
|
@ -48,6 +48,7 @@ public final class TestFrameRecord {
|
||||
assertEquals( 8, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
FrameRecord record = new FrameRecord();
|
||||
@ -56,7 +57,6 @@ public final class TestFrameRecord {
|
||||
record.setAutoSize( false );
|
||||
record.setAutoPosition( true );
|
||||
|
||||
|
||||
byte [] recordBytes = record.serialize();
|
||||
confirmRecordEncoding(FrameRecord.sid, data, recordBytes);
|
||||
}
|
||||
|
@ -62,22 +62,17 @@ public final class TestLegendRecord {
|
||||
assertEquals(24, record.getRecordSize());
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
LegendRecord record = new LegendRecord();
|
||||
|
||||
record.setXAxisUpperLeft(0xe76);
|
||||
|
||||
record.setYAxisUpperLeft(0x786);
|
||||
|
||||
record.setXSize(0x119);
|
||||
|
||||
record.setYSize(0x8b);
|
||||
|
||||
record.setType((byte) 0x3);
|
||||
|
||||
record.setSpacing((byte) 0x1);
|
||||
|
||||
record.setOptions((short) 0x1f);
|
||||
record.setAutoPosition(true);
|
||||
record.setAutoSeries(true);
|
||||
|
@ -54,6 +54,7 @@ public final class TestLineFormatRecord {
|
||||
assertEquals( 16, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
LineFormatRecord record = new LineFormatRecord();
|
||||
@ -64,7 +65,6 @@ public final class TestLineFormatRecord {
|
||||
record.setDrawTicks( false );
|
||||
record.setColourPaletteIndex( (short)0x4d );
|
||||
|
||||
|
||||
byte [] recordBytes = record.serialize();
|
||||
confirmRecordEncoding(LineFormatRecord.sid, data, recordBytes);
|
||||
}
|
||||
|
@ -175,6 +175,7 @@ recordid = 0x1051, size =8
|
||||
assertEquals( data.length + 4, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
LinkedDataRecord record = new LinkedDataRecord();
|
||||
|
@ -42,6 +42,7 @@ public final class TestNumberFormatIndexRecord {
|
||||
assertEquals( 6, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
NumberFormatIndexRecord record = new NumberFormatIndexRecord();
|
||||
|
@ -45,6 +45,7 @@ public final class TestObjectLinkRecord {
|
||||
assertEquals( 10, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
ObjectLinkRecord record = new ObjectLinkRecord();
|
||||
@ -53,7 +54,6 @@ public final class TestObjectLinkRecord {
|
||||
record.setLink1( (short)0x00 );
|
||||
record.setLink2( (short)0x00 );
|
||||
|
||||
|
||||
byte [] recordBytes = record.serialize();
|
||||
confirmRecordEncoding(ObjectLinkRecord.sid, data, recordBytes);
|
||||
}
|
||||
|
@ -45,13 +45,13 @@ public final class TestPlotGrowthRecord {
|
||||
assertEquals( 12, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
PlotGrowthRecord record = new PlotGrowthRecord();
|
||||
record.setHorizontalScale( 65536 );
|
||||
record.setVerticalScale( 65536 );
|
||||
|
||||
|
||||
byte [] recordBytes = record.serialize();
|
||||
confirmRecordEncoding(PlotGrowthRecord.sid, data, recordBytes);
|
||||
}
|
||||
|
@ -42,12 +42,12 @@ public final class TestSeriesChartGroupIndexRecord {
|
||||
assertEquals( 6, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
SeriesChartGroupIndexRecord record = new SeriesChartGroupIndexRecord();
|
||||
record.setChartGroupIndex( (short)0 );
|
||||
|
||||
|
||||
byte [] recordBytes = record.serialize();
|
||||
confirmRecordEncoding(SeriesChartGroupIndexRecord.sid, data, recordBytes);
|
||||
}
|
||||
|
@ -42,12 +42,12 @@ public final class TestSeriesIndexRecord {
|
||||
assertEquals( 6, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
SeriesIndexRecord record = new SeriesIndexRecord();
|
||||
record.setIndex( (short)3 );
|
||||
|
||||
|
||||
byte [] recordBytes = record.serialize();
|
||||
confirmRecordEncoding(SeriesIndexRecord.sid, data, recordBytes);
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ public final class TestSeriesLabelsRecord {
|
||||
assertEquals( 2+4, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
SeriesLabelsRecord record = new SeriesLabelsRecord();
|
||||
@ -60,7 +61,6 @@ public final class TestSeriesLabelsRecord {
|
||||
record.setShowLabel( false );
|
||||
record.setShowBubbleSizes( false );
|
||||
|
||||
|
||||
byte [] recordBytes = record.serialize();
|
||||
confirmRecordEncoding(SeriesLabelsRecord.sid, data, recordBytes);
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ public final class TestSeriesListRecord {
|
||||
assertEquals( 4 + 6, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
SeriesListRecord record = new SeriesListRecord(new short[] { (short)0x2001, (short)0xf0ff } );
|
||||
|
@ -53,6 +53,7 @@ public final class TestSeriesRecord {
|
||||
assertEquals( 16, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
SeriesRecord record = new SeriesRecord();
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.poi.hssf.record.chart;
|
||||
|
||||
import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@ -43,6 +44,7 @@ public final class TestSeriesTextRecord {
|
||||
assertEquals(SIMPLE_DATA.length + 4, record.getRecordSize());
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
SeriesTextRecord record = new SeriesTextRecord();
|
||||
@ -51,7 +53,7 @@ public final class TestSeriesTextRecord {
|
||||
record.setText("Value Number");
|
||||
|
||||
byte[] recordBytes = record.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(SeriesTextRecord.sid, SIMPLE_DATA, recordBytes);
|
||||
confirmRecordEncoding(SeriesTextRecord.sid, SIMPLE_DATA, recordBytes);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -88,6 +90,6 @@ public final class TestSeriesTextRecord {
|
||||
|
||||
assertTrue("Identified bug 45784b", str.getRecordSize() >= 0);
|
||||
byte[] ser = str.serialize();
|
||||
TestcaseRecordInputStream.confirmRecordEncoding(SeriesTextRecord.sid, data, ser);
|
||||
confirmRecordEncoding(SeriesTextRecord.sid, data, ser);
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public final class TestSeriesToChartGroupRecord {
|
||||
assertEquals( 0x6, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
SeriesToChartGroupRecord record = new SeriesToChartGroupRecord();
|
||||
|
@ -56,6 +56,7 @@ public final class TestSheetPropertiesRecord {
|
||||
assertEquals( 8, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
SheetPropertiesRecord record = new SheetPropertiesRecord();
|
||||
|
@ -81,6 +81,7 @@ public final class TestTextRecord {
|
||||
assertEquals( 36, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
TextRecord record = new TextRecord();
|
||||
|
@ -63,6 +63,7 @@ public final class TestTickRecord {
|
||||
assertEquals( 34, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
TickRecord record = new TickRecord();
|
||||
|
@ -43,6 +43,7 @@ public final class TestUnitsRecord {
|
||||
assertEquals( 6, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
UnitsRecord record = new UnitsRecord();
|
||||
|
@ -64,6 +64,7 @@ public final class TestValueRangeRecord {
|
||||
assertEquals( 42+4, record.getRecordSize() );
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testStore() {
|
||||
ValueRangeRecord record = new ValueRangeRecord();
|
||||
|
@ -44,6 +44,7 @@ public final class TestExtendedPivotTableViewFieldsRecord {
|
||||
assertEquals(data.length, rec.getRecordSize());
|
||||
}
|
||||
|
||||
@SuppressWarnings("squid:S2699")
|
||||
@Test
|
||||
public void testOlderFormat_bug46918() {
|
||||
// There are 10 SXVDEX records in the file (not uploaded) that originated bugzilla 46918
|
||||
|
Loading…
x
Reference in New Issue
Block a user