You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by jo...@apache.org on 2008/09/12 08:58:54 UTC
svn commit: r694619 - in /poi/trunk/src: java/org/apache/poi/util/
testcases/org/apache/poi/ddf/ testcases/org/apache/poi/hssf/record/
Author: josh
Date: Thu Sep 11 23:58:52 2008
New Revision: 694619
URL: http://svn.apache.org/viewvc?rev=694619&view=rev
Log:
Removed trailing comma from output of HexDump.toHex()
Modified:
poi/trunk/src/java/org/apache/poi/util/HexDump.java
poi/trunk/src/java/org/apache/poi/util/HexRead.java
poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherBSERecord.java
poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherBlipWMFRecord.java
poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherChildAnchorRecord.java
poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherClientAnchorRecord.java
poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherClientDataRecord.java
poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java
poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDgRecord.java
poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDggRecord.java
poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java
poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherPropertyFactory.java
poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSpRecord.java
poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSpgrRecord.java
poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSplitMenuColorsRecord.java
poi/trunk/src/testcases/org/apache/poi/ddf/TestUnknownEscherRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDrawingGroupRecord.java
poi/trunk/src/testcases/org/apache/poi/hssf/record/TestEscherAggregate.java
Modified: poi/trunk/src/java/org/apache/poi/util/HexDump.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/HexDump.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/HexDump.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/HexDump.java Thu Sep 11 23:58:52 2008
@@ -255,8 +255,10 @@
retVal.append('[');
for(int x = 0; x < value.length; x++)
{
+ if (x>0) {
+ retVal.append(", ");
+ }
retVal.append(toHex(value[x]));
- retVal.append(", ");
}
retVal.append(']');
return retVal.toString();
Modified: poi/trunk/src/java/org/apache/poi/util/HexRead.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/HexRead.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/HexRead.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/HexRead.java Thu Sep 11 23:58:52 2008
@@ -172,9 +172,12 @@
return rval;
}
- static public byte[] readFromString(String data) throws IOException
- {
- return readData(new ByteArrayInputStream( data.getBytes() ), -1);
+ static public byte[] readFromString(String data) {
+ try {
+ return readData(new ByteArrayInputStream( data.getBytes() ), -1);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
}
static private void readToEOL( InputStream stream ) throws IOException
Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherBSERecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherBSERecord.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherBSERecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherBSERecord.java Thu Sep 11 23:58:52 2008
@@ -37,7 +37,7 @@
assertEquals( (short) 0x0001, r.getOptions() );
assertEquals( EscherBSERecord.BT_JPEG, r.getBlipTypeWin32() );
assertEquals( EscherBSERecord.BT_JPEG, r.getBlipTypeMacOS() );
- assertEquals( "[01, 02, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F, 00, ]", HexDump.toHex( r.getUid() ) );
+ assertEquals( "[01, 02, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F, 00]", HexDump.toHex( r.getUid() ) );
assertEquals( (short) 1, r.getTag() );
assertEquals( 2, r.getRef() );
assertEquals( 3, r.getOffset() );
@@ -57,7 +57,7 @@
assertEquals( 44, bytesWritten );
assertEquals( "[01, 00, 00, 00, 24, 00, 00, 00, 05, 05, 01, 02, 03, 04, " +
"05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F, 00, 01, 00, 00, 00, " +
- "00, 00, 02, 00, 00, 00, 03, 00, 00, 00, 04, 05, 06, 07, ]",
+ "00, 00, 02, 00, 00, 00, 03, 00, 00, 00, 04, 05, 06, 07]",
HexDump.toHex( data ) );
}
@@ -90,7 +90,7 @@
" Options: 0x0001" + nl +
" BlipTypeWin32: 5" + nl +
" BlipTypeMacOS: 5" + nl +
- " SUID: [01, 02, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F, 00, ]" + nl +
+ " SUID: [01, 02, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F, 00]" + nl +
" Tag: 1" + nl +
" Size: 0" + nl +
" Ref: 2" + nl +
Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherBlipWMFRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherBlipWMFRecord.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherBlipWMFRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherBlipWMFRecord.java Thu Sep 11 23:58:52 2008
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
+
package org.apache.poi.ddf;
import junit.framework.TestCase;
@@ -36,8 +35,7 @@
data = HexRead.readFromString(dataStr);
}
- public void testSerialize() throws Exception
- {
+ public void testSerialize() {
EscherBlipWMFRecord r = new EscherBlipWMFRecord();
r.setBoundaryLeft(1);
r.setBoundaryHeight(2);
@@ -72,14 +70,13 @@
"05, 00, 00, 00, " + // field_9_cacheOfSavedSize
"08, " + // field_10_compressionFlag
"07, " + // field_11_filter
- "01, 02, ]", // field_12_data
+ "01, 02]", // field_12_data
HexDump.toHex(buf));
assertEquals(60, r.getRecordSize() );
}
- public void testFillFields() throws Exception
- {
+ public void testFillFields() {
EscherBlipWMFRecord r = new EscherBlipWMFRecord();
r.fillFields( data, 0, new DefaultEscherRecordFactory());
@@ -92,15 +89,14 @@
assertEquals( 6, r.getCacheOfSize() );
assertEquals( 7, r.getFilter() );
assertEquals( 8, r.getCompressionFlag() );
- assertEquals( "[01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, ]", HexDump.toHex(r.getSecondaryUID() ) );
+ assertEquals( "[01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01]", HexDump.toHex(r.getSecondaryUID() ) );
assertEquals( 10, r.getWidth() );
assertEquals( 11, r.getHeight() );
assertEquals( (short)5420, r.getOptions() );
- assertEquals( "[01, 02, ]", HexDump.toHex( r.getData() ) );
+ assertEquals( "[01, 02]", HexDump.toHex( r.getData() ) );
}
- public void testToString() throws Exception
- {
+ public void testToString() {
EscherBlipWMFRecord r = new EscherBlipWMFRecord();
r.fillFields( data, 0, new DefaultEscherRecordFactory() );
@@ -109,7 +105,7 @@
assertEquals( "org.apache.poi.ddf.EscherBlipWMFRecord:" + nl +
" RecordId: 0xF018" + nl +
" Options: 0x152C" + nl +
- " Secondary UID: [01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, ]" + nl +
+ " Secondary UID: [01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01]" + nl +
" CacheOfSize: 6" + nl +
" BoundaryTop: 3" + nl +
" BoundaryLeft: 1" + nl +
@@ -124,5 +120,5 @@
"00000000 01 02 .." + nl
, r.toString() );
}
-
}
+
Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherChildAnchorRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherChildAnchorRecord.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherChildAnchorRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherChildAnchorRecord.java Thu Sep 11 23:58:52 2008
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
+
package org.apache.poi.ddf;
import junit.framework.TestCase;
@@ -24,8 +23,7 @@
public class TestEscherChildAnchorRecord extends TestCase
{
- public void testSerialize() throws Exception
- {
+ public void testSerialize() {
EscherChildAnchorRecord r = createRecord();
byte[] data = new byte[8 + 16];
@@ -37,7 +35,7 @@
"01, 00, 00, 00, " +
"02, 00, 00, 00, " +
"03, 00, 00, 00, " +
- "04, 00, 00, 00, ]", HexDump.toHex( data ) );
+ "04, 00, 00, 00]", HexDump.toHex( data ) );
}
public void testFillFields() throws Exception
@@ -62,8 +60,7 @@
assertEquals( (short) 0x0001, r.getOptions() );
}
- public void testToString() throws Exception
- {
+ public void testToString(){
String nl = System.getProperty( "line.separator" );
String expected = "org.apache.poi.ddf.EscherChildAnchorRecord:" + nl +
@@ -76,7 +73,7 @@
assertEquals( expected, createRecord().toString() );
}
- private EscherChildAnchorRecord createRecord()
+ private static EscherChildAnchorRecord createRecord()
{
EscherChildAnchorRecord r = new EscherChildAnchorRecord();
r.setRecordId( EscherChildAnchorRecord.RECORD_ID );
@@ -87,5 +84,5 @@
r.setDy2( 4 );
return r;
}
-
}
+
Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherClientAnchorRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherClientAnchorRecord.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherClientAnchorRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherClientAnchorRecord.java Thu Sep 11 23:58:52 2008
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
+
package org.apache.poi.ddf;
import junit.framework.TestCase;
@@ -24,8 +23,7 @@
public class TestEscherClientAnchorRecord extends TestCase
{
- public void testSerialize() throws Exception
- {
+ public void testSerialize() {
EscherClientAnchorRecord r = createRecord();
byte[] data = new byte[8 + 18 + 2];
@@ -37,11 +35,10 @@
"4D, 00, 37, 00, 21, 00, 58, 00, " +
"0B, 00, 2C, 00, 16, 00, 63, 00, " +
"42, 00, " +
- "FF, DD, ]", HexDump.toHex( data ) );
+ "FF, DD]", HexDump.toHex( data ) );
}
- public void testFillFields() throws Exception
- {
+ public void testFillFields() {
String hexData = "01 00 " +
"10 F0 " +
"14 00 00 00 " +
@@ -68,8 +65,7 @@
assertEquals( (byte) 0xDD, r.getRemainingData()[1] );
}
- public void testToString() throws Exception
- {
+ public void testToString() {
String nl = System.getProperty("line.separator");
String expected = "org.apache.poi.ddf.EscherClientAnchorRecord:" + nl +
Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherClientDataRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherClientDataRecord.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherClientDataRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherClientDataRecord.java Thu Sep 11 23:58:52 2008
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
+
package org.apache.poi.ddf;
import junit.framework.TestCase;
@@ -24,8 +23,7 @@
public class TestEscherClientDataRecord extends TestCase
{
- public void testSerialize() throws Exception
- {
+ public void testSerialize() {
EscherClientDataRecord r = createRecord();
byte[] data = new byte[8];
@@ -33,12 +31,11 @@
assertEquals( 8, bytesWritten );
assertEquals( "[02, 00, " +
"11, F0, " +
- "00, 00, 00, 00, ]",
+ "00, 00, 00, 00]",
HexDump.toHex( data ) );
}
- public void testFillFields() throws Exception
- {
+ public void testFillFields() {
String hexData = "02 00 " +
"11 F0 " +
"00 00 00 00 ";
@@ -51,8 +48,7 @@
assertEquals( "[]", HexDump.toHex(r.getRemainingData()) );
}
- public void testToString() throws Exception
- {
+ public void testToString() {
String nl = System.getProperty("line.separator");
String expected = "org.apache.poi.ddf.EscherClientDataRecord:" + nl +
@@ -63,7 +59,7 @@
assertEquals( expected, createRecord().toString() );
}
- private EscherClientDataRecord createRecord()
+ private static EscherClientDataRecord createRecord()
{
EscherClientDataRecord r = new EscherClientDataRecord();
r.setOptions( (short) 0x0002 );
@@ -71,5 +67,4 @@
r.setRemainingData( new byte[] {} );
return r;
}
-
}
Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java Thu Sep 11 23:58:52 2008
@@ -30,13 +30,11 @@
{
private String ESCHER_DATA_PATH;
- protected void setUp() throws Exception {
- super.setUp();
+ protected void setUp() {
ESCHER_DATA_PATH = System.getProperty("DDF.testdata.path");
}
- public void testFillFields() throws Exception
- {
+ public void testFillFields() {
EscherRecordFactory f = new DefaultEscherRecordFactory();
byte[] data = HexRead.readFromString( "0F 02 11 F1 00 00 00 00" );
EscherRecord r = f.createRecord( data, 0 );
@@ -55,15 +53,14 @@
assertEquals( (short) 0xF222, c.getRecordId() );
}
- public void testSerialize() throws Exception
- {
+ public void testSerialize() {
UnknownEscherRecord r = new UnknownEscherRecord();
r.setOptions( (short) 0x123F );
r.setRecordId( (short) 0xF112 );
byte[] data = new byte[8];
r.serialize( 0, data, new NullEscherSerializationListener() );
- assertEquals( "[3F, 12, 12, F1, 00, 00, 00, 00, ]", HexDump.toHex( data ) );
+ assertEquals( "[3F, 12, 12, F1, 00, 00, 00, 00]", HexDump.toHex( data ) );
EscherRecord childRecord = new UnknownEscherRecord();
childRecord.setOptions( (short) 0x9999 );
@@ -72,12 +69,11 @@
data = new byte[16];
r.serialize( 0, data, new NullEscherSerializationListener() );
- assertEquals( "[3F, 12, 12, F1, 08, 00, 00, 00, 99, 99, 01, FF, 00, 00, 00, 00, ]", HexDump.toHex( data ) );
+ assertEquals( "[3F, 12, 12, F1, 08, 00, 00, 00, 99, 99, 01, FF, 00, 00, 00, 00]", HexDump.toHex( data ) );
}
- public void testToString() throws Exception
- {
+ public void testToString() {
EscherContainerRecord r = new EscherContainerRecord();
r.setRecordId( EscherContainerRecord.SP_CONTAINER );
r.setOptions( (short) 0x000F );
@@ -134,8 +130,7 @@
assertEquals( expected, r.toString() );
}
- public void testGetRecordSize() throws Exception
- {
+ public void testGetRecordSize() {
EscherContainerRecord r = new EscherContainerRecord();
r.addChildRecord(new EscherRecord()
{
Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDgRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDgRecord.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDgRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDgRecord.java Thu Sep 11 23:58:52 2008
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
+
package org.apache.poi.ddf;
import junit.framework.TestCase;
@@ -24,8 +23,7 @@
public class TestEscherDgRecord extends TestCase
{
- public void testSerialize() throws Exception
- {
+ public void testSerialize() {
EscherDgRecord r = createRecord();
byte[] data = new byte[16];
@@ -35,12 +33,11 @@
"08, F0, " +
"08, 00, 00, 00, " +
"02, 00, 00, 00, " + // num shapes in drawing
- "01, 04, 00, 00, ]", // The last MSOSPID given to an SP in this DG
+ "01, 04, 00, 00]", // The last MSOSPID given to an SP in this DG
HexDump.toHex( data ) );
}
- public void testFillFields() throws Exception
- {
+ public void testFillFields() {
String hexData = "10 00 " +
"08 F0 " +
"08 00 00 00 " +
@@ -55,8 +52,7 @@
assertEquals( 1025, r.getLastMSOSPID() );
}
- public void testToString() throws Exception
- {
+ public void testToString() {
String nl = System.getProperty("line.separator");
String expected = "org.apache.poi.ddf.EscherDgRecord:" + nl +
@@ -67,7 +63,7 @@
assertEquals( expected, createRecord().toString() );
}
- private EscherDgRecord createRecord()
+ private static EscherDgRecord createRecord()
{
EscherDgRecord r = new EscherDgRecord();
r.setOptions( (short) 0x0010 );
@@ -76,5 +72,4 @@
r.setLastMSOSPID(1025);
return r;
}
-
}
Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDggRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDggRecord.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDggRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherDggRecord.java Thu Sep 11 23:58:52 2008
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
+
package org.apache.poi.ddf;
import junit.framework.TestCase;
@@ -24,8 +23,7 @@
public class TestEscherDggRecord extends TestCase
{
- public void testSerialize() throws Exception
- {
+ public void testSerialize() {
EscherDggRecord r = createRecord();
byte[] data = new byte[32];
@@ -38,12 +36,11 @@
"02, 00, 00, 00, " +
"02, 00, 00, 00, " +
"01, 00, 00, 00, " +
- "01, 00, 00, 00, 02, 00, 00, 00, ]",
+ "01, 00, 00, 00, 02, 00, 00, 00]",
HexDump.toHex( data ) );
}
- public void testFillFields() throws Exception
- {
+ public void testFillFields() {
String hexData = "00 00 " +
"06 F0 " +
"18 00 00 00 " +
@@ -66,8 +63,7 @@
assertEquals( 0x02, r.getFileIdClusters()[0].getNumShapeIdsUsed());
}
- public void testToString() throws Exception
- {
+ public void testToString() {
String nl = System.getProperty("line.separator");
String expected = "org.apache.poi.ddf.EscherDggRecord:" + nl +
@@ -82,7 +78,7 @@
assertEquals( expected, createRecord().toString() );
}
- private EscherDggRecord createRecord()
+ private static EscherDggRecord createRecord()
{
EscherDggRecord r = new EscherDggRecord();
r.setOptions( (short) 0x0000 );
@@ -96,12 +92,9 @@
return r;
}
- public void testGetRecordSize() throws Exception
- {
+ public void testGetRecordSize() {
EscherDggRecord r = new EscherDggRecord();
r.setFileIdClusters(new EscherDggRecord.FileIdCluster[] { new EscherDggRecord.FileIdCluster(0,0) } );
assertEquals(32,r.getRecordSize());
-
}
-
}
Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java Thu Sep 11 23:58:52 2008
@@ -24,20 +24,16 @@
import java.io.IOException;
import java.util.Arrays;
-import java.util.List;
-import java.util.Iterator;
public class TestEscherOptRecord extends TestCase
{
- public void testFillFields() throws Exception
- {
+ public void testFillFields() {
checkFillFieldsSimple();
checkFillFieldsComplex();
}
- private void checkFillFieldsComplex() throws IOException
- {
+ private void checkFillFieldsComplex() {
String dataStr = "33 00 " +
"0B F0 " +
"14 00 00 00 " +
@@ -60,9 +56,7 @@
}
- private void checkFillFieldsSimple()
- throws IOException
- {
+ private void checkFillFieldsSimple() {
String dataStr = "33 00 " + // options
"0B F0 " + // recordid
"12 00 00 00 " + // remaining bytes
@@ -83,8 +77,7 @@
assertEquals( prop3, r.getEscherProperty( 2 ) );
}
- public void testSerialize() throws Exception
- {
+ public void testSerialize() {
checkSerializeSimple();
checkSerializeComplex();
}
@@ -111,7 +104,7 @@
"BF, 00, 01, 00, 00, 00, " +
"01, 80, 02, 00, 00, 00, " +
"BF, 00, 01, 00, 00, 00, " +
- "01, 02, ]";
+ "01, 02]";
assertEquals( dataStr, HexDump.toHex(data) );
}
@@ -135,13 +128,12 @@
"12, 00, 00, 00, " +
"BF, 00, 01, 00, 00, 00, " +
"81, 01, 09, 00, 00, 08, " +
- "C0, 01, 40, 00, 00, 08, ]";
+ "C0, 01, 40, 00, 00, 08]";
assertEquals( dataStr, HexDump.toHex(data) );
assertEquals( 26, bytesWritten );
}
- public void testToString() throws Exception
- {
+ public void testToString() {
String nl = System.getProperty("line.separator");
EscherOptRecord r = new EscherOptRecord();
r.setOptions((short)0x000F);
@@ -162,8 +154,8 @@
* Test serialisation of a particually complex example
* This test is currently broken!
*/
- public void testComplexSerialise() throws Exception {
- byte[] data = new byte[] {
+ public void testComplexSerialise() {
+ byte[] data = {
0x53, 0x01, 0x0B, 0xF0-256, 0x9C-256, 0x01, 0x00, 0x00,
// Simple data follows
0x42, 0x01, 0x49, 0x00, 0x00, 0x00, // SP @ 8
@@ -263,7 +255,7 @@
*
* See Bug 41946 for details.
*/
- public void test41946() throws IOException {
+ public void test41946() {
String dataStr1 =
"03 08 0B F0 00 03 00 00 81 00 30 65 01 00 82 00 98 B2 00 00 83 00 30 65 01 " +
"00 84 00 98 B2 00 00 85 00 00 00 00 00 87 00 01 00 00 00 88 00 00 00 00 00 " +
@@ -315,7 +307,7 @@
* Test that EscherOptRecord can properly read/write array properties
* with empty complex part.
*/
- public void testEmptyArrayProperty() throws IOException {
+ public void testEmptyArrayProperty() {
EscherOptRecord r = new EscherOptRecord();
EscherArrayProperty p = new EscherArrayProperty((short)(EscherProperties.FILL__SHADECOLORS + 0x8000), new byte[0] );
assertEquals(0, p.getNumberOfElementsInArray());
Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherPropertyFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherPropertyFactory.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherPropertyFactory.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherPropertyFactory.java Thu Sep 11 23:58:52 2008
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
+
package org.apache.poi.ddf;
import junit.framework.TestCase;
@@ -30,8 +29,7 @@
*/
public class TestEscherPropertyFactory extends TestCase
{
- public void testCreateProperties() throws Exception
- {
+ public void testCreateProperties() {
String dataStr = "41 C1 " + // propid, complex ind
"03 00 00 00 " + // size of complex property
"01 00 " + // propid, complex ind
@@ -46,15 +44,11 @@
List props = f.createProperties( data, 0, (short)3 );
EscherComplexProperty p1 = (EscherComplexProperty) props.get( 0 );
assertEquals( (short)0xC141, p1.getId() );
- assertEquals( "[01, 02, 03, ]", HexDump.toHex( p1.getComplexData() ) );
+ assertEquals( "[01, 02, 03]", HexDump.toHex( p1.getComplexData() ) );
EscherComplexProperty p3 = (EscherComplexProperty) props.get( 2 );
assertEquals( (short)0xC141, p3.getId() );
- assertEquals( "[01, 02, 03, ]", HexDump.toHex( p3.getComplexData() ) );
-
-
+ assertEquals( "[01, 02, 03]", HexDump.toHex( p3.getComplexData() ) );
}
-
-
-
}
+
Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSpRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSpRecord.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSpRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSpRecord.java Thu Sep 11 23:58:52 2008
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
+
package org.apache.poi.ddf;
import junit.framework.TestCase;
@@ -24,8 +23,7 @@
public class TestEscherSpRecord extends TestCase
{
- public void testSerialize() throws Exception
- {
+ public void testSerialize() {
EscherSpRecord r = createRecord();
byte[] data = new byte[16];
@@ -35,12 +33,11 @@
"0A, F0, " +
"08, 00, 00, 00, " +
"00, 04, 00, 00, " +
- "05, 00, 00, 00, ]",
+ "05, 00, 00, 00]",
HexDump.toHex( data ) );
}
- public void testFillFields() throws Exception
- {
+ public void testFillFields() {
String hexData = "02 00 " +
"0A F0 " +
"08 00 00 00 " +
@@ -55,8 +52,7 @@
assertEquals( 0x05, r.getFlags() );
}
- public void testToString() throws Exception
- {
+ public void testToString() {
String nl = System.getProperty("line.separator");
String expected = "org.apache.poi.ddf.EscherSpRecord:" + nl +
@@ -67,7 +63,7 @@
assertEquals( expected, createRecord().toString() );
}
- private EscherSpRecord createRecord()
+ private static EscherSpRecord createRecord()
{
EscherSpRecord r = new EscherSpRecord();
r.setOptions( (short) 0x0002 );
Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSpgrRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSpgrRecord.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSpgrRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSpgrRecord.java Thu Sep 11 23:58:52 2008
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
+
package org.apache.poi.ddf;
import junit.framework.TestCase;
@@ -24,8 +23,7 @@
public class TestEscherSpgrRecord extends TestCase
{
- public void testSerialize() throws Exception
- {
+ public void testSerialize() {
EscherSpgrRecord r = createRecord();
byte[] data = new byte[24];
@@ -37,12 +35,11 @@
"01, 00, 00, 00, " + // x
"02, 00, 00, 00, " + // y
"03, 00, 00, 00, " + // width
- "04, 00, 00, 00, ]", // height
+ "04, 00, 00, 00]", // height
HexDump.toHex( data ) );
}
- public void testFillFields() throws Exception
- {
+ public void testFillFields() {
String hexData = "10 00 " +
"09 F0 " +
"10 00 00 00 " +
@@ -61,8 +58,7 @@
assertEquals( 4, r.getRectY2() );
}
- public void testToString() throws Exception
- {
+ public void testToString() {
String nl = System.getProperty("line.separator");
String expected = "org.apache.poi.ddf.EscherSpgrRecord:" + nl +
@@ -72,11 +68,10 @@
" RectY: 2" + nl +
" RectWidth: 3" + nl +
" RectHeight: 4" + nl;
- ;
assertEquals( expected, createRecord().toString() );
}
- private EscherSpgrRecord createRecord()
+ private static EscherSpgrRecord createRecord()
{
EscherSpgrRecord r = new EscherSpgrRecord();
r.setOptions( (short) 0x0010 );
@@ -87,5 +82,4 @@
r.setRectY2(4);
return r;
}
-
}
Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSplitMenuColorsRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSplitMenuColorsRecord.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSplitMenuColorsRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestEscherSplitMenuColorsRecord.java Thu Sep 11 23:58:52 2008
@@ -24,8 +24,7 @@
public class TestEscherSplitMenuColorsRecord extends TestCase
{
- public void testSerialize() throws Exception
- {
+ public void testSerialize() {
EscherSplitMenuColorsRecord r = createRecord();
byte[] data = new byte[24];
@@ -37,12 +36,11 @@
"02, 04, 00, 00, " +
"02, 00, 00, 00, " +
"02, 00, 00, 00, " +
- "01, 00, 00, 00, ]",
+ "01, 00, 00, 00]",
HexDump.toHex( data ) );
}
- public void testFillFields() throws Exception
- {
+ public void testFillFields() {
String hexData = "40 00 " +
"1E F1 " +
"10 00 00 00 " +
@@ -61,8 +59,7 @@
assertEquals( 0x01, r.getColor4() );
}
- public void testToString() throws Exception
- {
+ public void testToString() {
String nl = System.getProperty("line.separator");
String expected = "org.apache.poi.ddf.EscherSplitMenuColorsRecord:" + nl +
@@ -76,7 +73,7 @@
assertEquals( expected, createRecord().toString() );
}
- private EscherSplitMenuColorsRecord createRecord()
+ private static EscherSplitMenuColorsRecord createRecord()
{
EscherSplitMenuColorsRecord r = new EscherSplitMenuColorsRecord();
r.setOptions( (short) 0x0040 );
@@ -87,5 +84,4 @@
r.setColor4( 0x1 );
return r;
}
-
}
Modified: poi/trunk/src/testcases/org/apache/poi/ddf/TestUnknownEscherRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ddf/TestUnknownEscherRecord.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ddf/TestUnknownEscherRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ddf/TestUnknownEscherRecord.java Thu Sep 11 23:58:52 2008
@@ -24,8 +24,7 @@
public class TestUnknownEscherRecord extends TestCase
{
- public void testFillFields() throws Exception
- {
+ public void testFillFields() {
String testData =
"0F 02 " + // options
"11 F1 " + // record id
@@ -82,15 +81,14 @@
}
- public void testSerialize() throws Exception
- {
+ public void testSerialize() {
UnknownEscherRecord r = new UnknownEscherRecord();
r.setOptions( (short) 0x1234 );
r.setRecordId( (short) 0xF112 );
byte[] data = new byte[8];
r.serialize( 0, data, new NullEscherSerializationListener() );
- assertEquals( "[34, 12, 12, F1, 00, 00, 00, 00, ]", HexDump.toHex( data ) );
+ assertEquals( "[34, 12, 12, F1, 00, 00, 00, 00]", HexDump.toHex( data ) );
EscherRecord childRecord = new UnknownEscherRecord();
childRecord.setOptions( (short) 0x9999 );
@@ -100,11 +98,10 @@
data = new byte[16];
r.serialize( 0, data, new NullEscherSerializationListener() );
- assertEquals( "[3F, 12, 12, F1, 08, 00, 00, 00, 99, 99, 01, FF, 00, 00, 00, 00, ]", HexDump.toHex( data ) );
+ assertEquals( "[3F, 12, 12, F1, 08, 00, 00, 00, 99, 99, 01, FF, 00, 00, 00, 00]", HexDump.toHex( data ) );
}
- public void testToString() throws Exception
- {
+ public void testToString() {
UnknownEscherRecord r = new UnknownEscherRecord();
r.setOptions( (short) 0x1234 );
r.setRecordId( (short) 0xF112 );
@@ -119,6 +116,4 @@
" numchildren: 0" + nl
, r.toString() );
}
-
-
}
Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDrawingGroupRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDrawingGroupRecord.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDrawingGroupRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/TestDrawingGroupRecord.java Thu Sep 11 23:58:52 2008
@@ -22,14 +22,11 @@
import org.apache.poi.ddf.EscherSpRecord;
import org.apache.poi.util.HexDump;
-public class TestDrawingGroupRecord extends TestCase
-{
- static final int MAX_RECORD_SIZE = 8228;
+public final class TestDrawingGroupRecord extends TestCase {
+ private static final int MAX_RECORD_SIZE = 8228;
private static final int MAX_DATA_SIZE = MAX_RECORD_SIZE - 4;
- public void testGetRecordSize()
- throws Exception
- {
+ public void testGetRecordSize() {
DrawingGroupRecord r = new DrawingGroupRecord();
assertEquals(4, r.getRecordSize());
@@ -48,7 +45,7 @@
byte[] data = new byte[28];
int size = r.serialize(0, data);
- assertEquals("[EB, 00, 18, 00, 0F, 00, 00, F0, 10, 00, 00, 00, 11, 11, 0A, F0, 08, 00, 00, 00, FF, FF, FF, FF, FF, FF, FF, FF, ]", HexDump.toHex(data));
+ assertEquals("[EB, 00, 18, 00, 0F, 00, 00, F0, 10, 00, 00, 00, 11, 11, 0A, F0, 08, 00, 00, 00, FF, FF, FF, FF, FF, FF, FF, FF]", HexDump.toHex(data));
assertEquals(28, size);
assertEquals(24, dggContainer.getRecordSize());
@@ -65,8 +62,7 @@
assertEquals( MAX_RECORD_SIZE * 2 + 5, r.getRecordSize() );
}
- public void testSerialize() throws Exception
- {
+ public void testSerialize() {
// Check under max record size
DrawingGroupRecord r = new DrawingGroupRecord();
byte[] rawData = new byte[100];
@@ -76,7 +72,7 @@
byte[] buffer = new byte[r.getRecordSize()];
int size = r.serialize( 0, buffer );
assertEquals( 104, size );
- assertEquals("[EB, 00, 64, 00, 64, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, C8, ]", HexDump.toHex(buffer));
+ assertEquals("[EB, 00, 64, 00, 64, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, C8]", HexDump.toHex(buffer));
// check at max record size
rawData = new byte[MAX_DATA_SIZE];
@@ -92,8 +88,8 @@
buffer = new byte[r.getRecordSize()];
size = r.serialize( 0, buffer );
assertEquals( MAX_RECORD_SIZE + 5, size );
- assertEquals( "[EB, 00, 20, 20, ]", HexDump.toHex(cut(buffer, 0, 4) ));
- assertEquals( "[00, EB, 00, 01, 00, FF, ]", HexDump.toHex(cut(buffer, MAX_RECORD_SIZE - 1, MAX_RECORD_SIZE + 5) ));
+ assertEquals( "[EB, 00, 20, 20]", HexDump.toHex(cut(buffer, 0, 4) ));
+ assertEquals( "[00, EB, 00, 01, 00, FF]", HexDump.toHex(cut(buffer, MAX_RECORD_SIZE - 1, MAX_RECORD_SIZE + 5) ));
// check continue record
rawData = new byte[MAX_DATA_SIZE * 2 + 1];
@@ -103,9 +99,9 @@
size = r.serialize( 0, buffer );
assertEquals( MAX_RECORD_SIZE * 2 + 5, size );
assertEquals( MAX_RECORD_SIZE * 2 + 5, r.getRecordSize() );
- assertEquals( "[EB, 00, 20, 20, ]", HexDump.toHex(cut(buffer, 0, 4) ));
- assertEquals( "[EB, 00, 20, 20, ]", HexDump.toHex(cut(buffer, MAX_RECORD_SIZE, MAX_RECORD_SIZE + 4) ));
- assertEquals( "[3C, 00, 01, 00, FF, ]", HexDump.toHex(cut(buffer, MAX_RECORD_SIZE * 2, MAX_RECORD_SIZE * 2 + 5) ));
+ assertEquals( "[EB, 00, 20, 20]", HexDump.toHex(cut(buffer, 0, 4) ));
+ assertEquals( "[EB, 00, 20, 20]", HexDump.toHex(cut(buffer, MAX_RECORD_SIZE, MAX_RECORD_SIZE + 4) ));
+ assertEquals( "[3C, 00, 01, 00, FF]", HexDump.toHex(cut(buffer, MAX_RECORD_SIZE * 2, MAX_RECORD_SIZE * 2 + 5) ));
// check continue record
rawData = new byte[664532];
@@ -116,7 +112,7 @@
assertEquals( 664856, r.getRecordSize() );
}
- private byte[] cut( byte[] data, int fromInclusive, int toExclusive )
+ private static byte[] cut( byte[] data, int fromInclusive, int toExclusive )
{
int length = toExclusive - fromInclusive;
byte[] result = new byte[length];
@@ -124,8 +120,7 @@
return result;
}
- public void testGrossSizeFromDataSize() throws Exception
- {
+ public void testGrossSizeFromDataSize() {
for (int i = 0; i < MAX_RECORD_SIZE * 4; i += 11)
{
//System.out.print( "data size = " + i + ", gross size = " + DrawingGroupRecord.grossSizeFromDataSize( i ) );
@@ -139,6 +134,4 @@
assertEquals( MAX_RECORD_SIZE * 2, DrawingGroupRecord.grossSizeFromDataSize( MAX_DATA_SIZE * 2 ) );
assertEquals( MAX_RECORD_SIZE * 2 + 5, DrawingGroupRecord.grossSizeFromDataSize( MAX_DATA_SIZE * 2 + 1 ) );
}
-
-
}
Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/TestEscherAggregate.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/TestEscherAggregate.java?rev=694619&r1=694618&r2=694619&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/TestEscherAggregate.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/TestEscherAggregate.java Thu Sep 11 23:58:52 2008
@@ -133,7 +133,7 @@
byte[] data = new byte[112];
int bytesWritten = aggregate.serialize( 0, data );
assertEquals( 112, bytesWritten );
- assertEquals( "[EC, 00, 40, 00, 0F, 00, 00, 00, 58, 00, 00, 00, 0F, 00, 04, F0, 10, 00, 00, 00, 00, 00, 0A, F0, 08, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 0F, 00, 04, F0, 18, 00, 00, 00, 00, 00, 0A, F0, 08, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, F0, 00, 00, 00, 00, 5D, 00, 00, 00, EC, 00, 20, 00, 0F, 00, 04, F0, 18, 00, 00, 00, 00, 00, 0A, F0, 08, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, F0, 00, 00, 00, 00, 5D, 00, 00, 00, ]",
+ assertEquals( "[EC, 00, 40, 00, 0F, 00, 00, 00, 58, 00, 00, 00, 0F, 00, 04, F0, 10, 00, 00, 00, 00, 00, 0A, F0, 08, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 0F, 00, 04, F0, 18, 00, 00, 00, 00, 00, 0A, F0, 08, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, F0, 00, 00, 00, 00, 5D, 00, 00, 00, EC, 00, 20, 00, 0F, 00, 04, F0, 18, 00, 00, 00, 00, 00, 0A, F0, 08, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, F0, 00, 00, 00, 00, 5D, 00, 00, 00]",
HexDump.toHex( data ) );
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org