FileDocCategorySizeDatePackage
ScaledNumberFormatTest.javaAPI DocExample1766Fri Mar 02 11:02:52 GMT 2001None

ScaledNumberFormatTest

public class ScaledNumberFormatTest extends TestCase
A simple test case for ScaledNumberFormat parse and format

Fields Summary
ScaledNumberFormat
sf
data[]
sdata
data for scan (parse) test
data[]
ddata
data for format test
Constructors Summary
public ScaledNumberFormatTest(String name)
JUnit test classes require this constructor

		super(name);
	
Methods Summary
public voidtestFormatGood()


	   
		for (int i = 0; i < ddata.length; i++) {
			try {
				assertEquals(ddata[i].string, sf.format(ddata[i].number));
			} catch (Exception ex) {
				System.out.println("ERROR IN FORMAT CASE " + i);
				System.out.println(ddata[i] + " threw " + ex);
			}
		}
	
public voidtestParseGood()


	   
		for (int i = 0; i<sdata.length; i++) {
			try {
				Object o = sf.parseObject(sdata[i].string, null);
				assert(((Long)o).longValue() == sdata[i].number);
			} catch (Exception ex) {
				System.out.println("ERROR IN PARSE CASE " + i);
				System.out.println(sdata[i] + " threw " + ex);
			}
		}