Nothing to see here

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352915 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Glen Stampoultzis 2002-11-14 11:57:13 +00:00
parent c875478b07
commit 74619707cd

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
@ -52,7 +51,6 @@
* information on the Apache Software Foundation, please see * information on the Apache Software Foundation, please see
* <http://www.apache.org/>. * <http://www.apache.org/>.
*/ */
package org.apache.poi.util; package org.apache.poi.util;
import junit.framework.*; import junit.framework.*;
@ -66,17 +64,14 @@ import java.text.NumberFormat;
* @author Glen Stampoultzis (glens at apache.org) * @author Glen Stampoultzis (glens at apache.org)
* @author Sergei Kozello (sergeikozello at mail.ru) * @author Sergei Kozello (sergeikozello at mail.ru)
*/ */
public class TestStringUtil public class TestStringUtil
extends TestCase extends TestCase
{ {
/** /**
* Creates new TestStringUtil * Creates new TestStringUtil
* *
* @param name * @param name
*/ */
public TestStringUtil( String name ) public TestStringUtil( String name )
{ {
super( name ); super( name );
@ -85,7 +80,6 @@ public class TestStringUtil
/** /**
* test simple form of getFromUnicode * test simple form of getFromUnicode
*/ */
public void testSimpleGetFromUnicode() public void testSimpleGetFromUnicode()
{ {
byte[] test_data = new byte[32]; byte[] test_data = new byte[32];
@ -96,6 +90,7 @@ public class TestStringUtil
test_data[index++] = (byte) 0; test_data[index++] = (byte) 0;
test_data[index++] = (byte) ( 'a' + k ); test_data[index++] = (byte) ( 'a' + k );
} }
assertEquals( "abcdefghijklmnop", assertEquals( "abcdefghijklmnop",
StringUtil.getFromUnicode( test_data ) ); StringUtil.getFromUnicode( test_data ) );
} }
@ -103,7 +98,6 @@ public class TestStringUtil
/** /**
* test simple form of getFromUnicode with symbols with code below and more 127 * test simple form of getFromUnicode with symbols with code below and more 127
*/ */
public void testGetFromUnicodeSymbolsWithCodesMoreThan127() public void testGetFromUnicodeSymbolsWithCodesMoreThan127()
{ {
byte[] test_data = new byte[]{0x04, 0x22, byte[] test_data = new byte[]{0x04, 0x22,
@ -124,7 +118,6 @@ public class TestStringUtil
/** /**
* test getFromUnicodeHigh for symbols with code below and more 127 * test getFromUnicodeHigh for symbols with code below and more 127
*/ */
public void testGetFromUnicodeHighSymbolsWithCodesMoreThan127() public void testGetFromUnicodeHighSymbolsWithCodesMoreThan127()
{ {
byte[] test_data = new byte[]{0x22, 0x04, byte[] test_data = new byte[]{0x22, 0x04,
@ -138,6 +131,7 @@ public class TestStringUtil
0x74, 0x00, 0x74, 0x00,
}; };
assertEquals( "\u0422\u0435\u0441\u0442 test", assertEquals( "\u0422\u0435\u0441\u0442 test",
StringUtil.getFromUnicodeHigh( test_data ) ); StringUtil.getFromUnicodeHigh( test_data ) );
} }
@ -145,12 +139,10 @@ public class TestStringUtil
/** /**
* Test more complex form of getFromUnicode * Test more complex form of getFromUnicode
*/ */
public void testComplexGetFromUnicode() public void testComplexGetFromUnicode()
{ {
byte[] test_data = new byte[32]; byte[] test_data = new byte[32];
int index = 0; int index = 0;
for ( int k = 0; k < 16; k++ ) for ( int k = 0; k < 16; k++ )
{ {
test_data[index++] = (byte) 0; test_data[index++] = (byte) 0;
@ -167,9 +159,9 @@ public class TestStringUtil
} }
catch ( ArrayIndexOutOfBoundsException ignored ) catch ( ArrayIndexOutOfBoundsException ignored )
{ {
// as expected // as expected
} }
try try
{ {
StringUtil.getFromUnicode( test_data, 32, 16 ); StringUtil.getFromUnicode( test_data, 32, 16 );
@ -177,9 +169,9 @@ public class TestStringUtil
} }
catch ( ArrayIndexOutOfBoundsException ignored ) catch ( ArrayIndexOutOfBoundsException ignored )
{ {
// as expected // as expected
} }
try try
{ {
StringUtil.getFromUnicode( test_data, 1, 16 ); StringUtil.getFromUnicode( test_data, 1, 16 );
@ -187,9 +179,9 @@ public class TestStringUtil
} }
catch ( IllegalArgumentException ignored ) catch ( IllegalArgumentException ignored )
{ {
// as expected // as expected
} }
try try
{ {
StringUtil.getFromUnicode( test_data, 1, -1 ); StringUtil.getFromUnicode( test_data, 1, -1 );
@ -197,7 +189,6 @@ public class TestStringUtil
} }
catch ( IllegalArgumentException ignored ) catch ( IllegalArgumentException ignored )
{ {
// as expected // as expected
} }
} }
@ -205,7 +196,6 @@ public class TestStringUtil
/** /**
* Test putCompressedUnicode * Test putCompressedUnicode
*/ */
public void testPutCompressedUnicode() throws Exception public void testPutCompressedUnicode() throws Exception
{ {
byte[] output = new byte[100]; byte[] output = new byte[100];
@ -238,7 +228,6 @@ public class TestStringUtil
} }
catch ( ArrayIndexOutOfBoundsException ignored ) catch ( ArrayIndexOutOfBoundsException ignored )
{ {
// as expected // as expected
} }
} }
@ -246,7 +235,6 @@ public class TestStringUtil
/** /**
* Test putUncompressedUnicode * Test putUncompressedUnicode
*/ */
public void testPutUncompressedUnicode() public void testPutUncompressedUnicode()
{ {
byte[] output = new byte[100]; byte[] output = new byte[100];
@ -281,11 +269,11 @@ public class TestStringUtil
} }
catch ( ArrayIndexOutOfBoundsException ignored ) catch ( ArrayIndexOutOfBoundsException ignored )
{ {
// as expected // as expected
} }
} }
public void testFormat() public void testFormat()
throws Exception throws Exception
{ {
@ -329,6 +317,7 @@ public class TestStringUtil
} ) ); } ) );
} }
private String fmt( double num, int minIntDigits, int maxFracDigitis ) private String fmt( double num, int minIntDigits, int maxFracDigitis )
{ {
NumberFormat nf = NumberFormat.getInstance(); NumberFormat nf = NumberFormat.getInstance();
@ -341,26 +330,31 @@ public class TestStringUtil
{ {
nf.setMaximumFractionDigits( maxFracDigitis ); nf.setMaximumFractionDigits( maxFracDigitis );
} }
return nf.format( num ); return nf.format( num );
} }
/** /**
* main * main
* *
* @param ignored_args * @param ignored_args
*/ */
public static void main( String[] ignored_args ) public static void main( String[] ignored_args )
{ {
System.out.println( "Testing util.StringUtil functionality" ); System.out.println( "Testing util.StringUtil functionality" );
junit.textui.TestRunner.run( TestStringUtil.class ); junit.textui.TestRunner.run( TestStringUtil.class );
} }
/** /**
* @see junit.framework.TestCase#setUp() * @see junit.framework.TestCase#setUp()
*/ */
protected void setUp() throws Exception { protected void setUp() throws Exception
{
super.setUp(); super.setUp();
// System.setProperty() // System.setProperty()
} }
} }