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