harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r386058 [45/49] - in /incubator/harmony/enhanced/classlib/trunk: make/ modules/archive/make/common/ modules/archive/src/test/java/tests/ modules/archive/src/test/java/tests/api/ modules/archive/src/test/java/tests/api/java/ modules/archive/...
Date Wed, 15 Mar 2006 11:47:39 GMT
Added: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/DecimalFormatSymbolsTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/DecimalFormatSymbolsTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/DecimalFormatSymbolsTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/DecimalFormatSymbolsTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,370 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.api.java.text;
+
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.NumberFormat;
+import java.util.Currency;
+import java.util.Locale;
+
+public class DecimalFormatSymbolsTest extends junit.framework.TestCase {
+
+	DecimalFormatSymbols dfs;
+
+	DecimalFormatSymbols dfsUS;
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#DecimalFormatSymbols()
+	 */
+	public void test_Constructor() {
+		// Test for method java.text.DecimalFormatSymbols()
+		// Used in tests
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#DecimalFormatSymbols(java.util.Locale)
+	 */
+	public void test_ConstructorLjava_util_Locale() {
+		DecimalFormatSymbols dfs = new DecimalFormatSymbols(new Locale("en",
+				"us"));
+		assertTrue("Returned incorrect symbols", dfs.getPercent() == '%');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#equals(java.lang.Object)
+	 */
+	public void test_equalsLjava_lang_Object() {
+		assertTrue("Equal objects returned false", dfs.equals(dfs.clone()));
+		dfs.setDigit('B');
+		assertTrue("Un-Equal objects returned true", !dfs
+				.equals(new DecimalFormatSymbols()));
+
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#getCurrency()
+	 */
+	public void test_getCurrency() {
+		Currency currency = Currency.getInstance("USD");
+		assertTrue("Returned incorrect currency",
+				dfsUS.getCurrency() == currency);
+
+		Currency currK = Currency.getInstance("KRW");
+		Currency currX = Currency.getInstance("XXX");
+		Currency currE = Currency.getInstance("EUR");
+		//Currency currF = Currency.getInstance("FRF");
+
+		DecimalFormatSymbols dfs1 = new DecimalFormatSymbols(new Locale("ko",
+				"KR"));
+		assertTrue("Test1: Returned incorrect currency",
+				dfs1.getCurrency() == currK);
+		assertTrue("Test1: Returned incorrect currencySymbol", dfs1
+				.getCurrencySymbol().equals("\uffe6"));
+		assertTrue("Test1: Returned incorrect intlCurrencySymbol", dfs1
+				.getInternationalCurrencySymbol().equals("KRW"));
+
+		dfs1 = new DecimalFormatSymbols(new Locale("", "KR"));
+		assertTrue("Test2: Returned incorrect currency",
+				dfs1.getCurrency() == currK);
+		assertTrue("Test2: Returned incorrect currencySymbol", dfs1
+				.getCurrencySymbol().equals("KRW"));
+		assertTrue("Test2: Returned incorrect intlCurrencySymbol", dfs1
+				.getInternationalCurrencySymbol().equals("KRW"));
+
+		dfs1 = new DecimalFormatSymbols(new Locale("ko", ""));
+		assertTrue("Test3: Returned incorrect currency",
+				dfs1.getCurrency() == currX);
+		assertTrue("Test3: Returned incorrect currencySymbol", dfs1
+				.getCurrencySymbol().equals("\u00a4"));
+		assertTrue("Test3: Returned incorrect intlCurrencySymbol", dfs1
+				.getInternationalCurrencySymbol().equals("XXX"));
+
+		dfs1 = new DecimalFormatSymbols(new Locale("fr", "FR"));
+		assertTrue("Test4: Returned incorrect currency",
+				dfs1.getCurrency() == currE);
+		assertTrue("Test4: Returned incorrect currencySymbol", dfs1
+				.getCurrencySymbol().equals("\u20ac"));
+		assertTrue("Test4: Returned incorrect intlCurrencySymbol", dfs1
+				.getInternationalCurrencySymbol().equals("EUR"));
+
+		// RI fails these tests since it doesn't have the PREEURO variant
+		// dfs1 = new DecimalFormatSymbols(new Locale("fr", "FR","PREEURO"));
+		// assertTrue("Test5: Returned incorrect currency", dfs1.getCurrency()
+		// == currF);
+		// assertTrue("Test5: Returned incorrect currencySymbol",
+		// dfs1.getCurrencySymbol().equals("F"));
+		// assertTrue("Test5: Returned incorrect intlCurrencySymbol",
+		// dfs1.getInternationalCurrencySymbol().equals("FRF"));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#getCurrencySymbol()
+	 */
+	public void test_getCurrencySymbol() {
+		assertTrue("Returned incorrect currencySymbol", dfsUS
+				.getCurrencySymbol().equals("$"));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#getDecimalSeparator()
+	 */
+	public void test_getDecimalSeparator() {
+		dfs.setDecimalSeparator('*');
+		assertTrue("Returned incorrect DecimalSeparator symbol", dfs
+				.getDecimalSeparator() == '*');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#getDigit()
+	 */
+	public void test_getDigit() {
+		dfs.setDigit('*');
+		assertTrue("Returned incorrect Digit symbol", dfs.getDigit() == '*');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#getGroupingSeparator()
+	 */
+	public void test_getGroupingSeparator() {
+		dfs.setGroupingSeparator('*');
+		assertTrue("Returned incorrect GroupingSeparator symbol", dfs
+				.getGroupingSeparator() == '*');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#getInfinity()
+	 */
+	public void test_getInfinity() {
+		dfs.setInfinity("&");
+		assertTrue("Returned incorrect Infinity symbol",
+				dfs.getInfinity() == "&");
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#getInternationalCurrencySymbol()
+	 */
+	public void test_getInternationalCurrencySymbol() {
+		assertTrue("Returned incorrect InternationalCurrencySymbol", dfsUS
+				.getInternationalCurrencySymbol().equals("USD"));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#getMinusSign()
+	 */
+	public void test_getMinusSign() {
+		dfs.setMinusSign('&');
+		assertTrue("Returned incorrect MinusSign symbol",
+				dfs.getMinusSign() == '&');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#getNaN()
+	 */
+	public void test_getNaN() {
+		dfs.setNaN("NAN!!");
+		assertTrue("Returned incorrect nan symbol", dfs.getNaN()
+				.equals("NAN!!"));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#getPatternSeparator()
+	 */
+	public void test_getPatternSeparator() {
+		dfs.setPatternSeparator('X');
+		assertTrue("Returned incorrect PatternSeparator symbol", dfs
+				.getPatternSeparator() == 'X');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#getPercent()
+	 */
+	public void test_getPercent() {
+		dfs.setPercent('*');
+		assertTrue("Returned incorrect Percent symbol", dfs.getPercent() == '*');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#getPerMill()
+	 */
+	public void test_getPerMill() {
+		dfs.setPerMill('#');
+		assertTrue("Returned incorrect PerMill symbol", dfs.getPerMill() == '#');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#getZeroDigit()
+	 */
+	public void test_getZeroDigit() {
+		dfs.setZeroDigit('*');
+		assertTrue("Returned incorrect ZeroDigit symbol",
+				dfs.getZeroDigit() == '*');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#setCurrency(java.util.Currency)
+	 */
+	public void test_setCurrencyLjava_util_Currency() {
+		Locale locale = Locale.CANADA;
+		DecimalFormatSymbols dfs = ((DecimalFormat) NumberFormat
+				.getCurrencyInstance(locale)).getDecimalFormatSymbols();
+
+		try {
+			dfs.setCurrency(null);
+			fail("Expected NullPointerException");
+		} catch (NullPointerException e) {
+		}
+
+		Currency currency = Currency.getInstance("JPY");
+		dfs.setCurrency(currency);
+
+		assertTrue("Returned incorrect currency", currency == dfs.getCurrency());
+		assertTrue("Returned incorrect currency symbol", currency.getSymbol(
+				locale).equals(dfs.getCurrencySymbol()));
+		assertTrue("Returned incorrect international currency symbol", currency
+				.getCurrencyCode().equals(dfs.getInternationalCurrencySymbol()));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#setDecimalSeparator(char)
+	 */
+	public void test_setDecimalSeparatorC() {
+		dfs.setDecimalSeparator('*');
+		assertTrue("Returned incorrect DecimalSeparator symbol", dfs
+				.getDecimalSeparator() == '*');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#setDigit(char)
+	 */
+	public void test_setDigitC() {
+		dfs.setDigit('*');
+		assertTrue("Returned incorrect Digit symbol", dfs.getDigit() == '*');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#setGroupingSeparator(char)
+	 */
+	public void test_setGroupingSeparatorC() {
+		dfs.setGroupingSeparator('*');
+		assertTrue("Returned incorrect GroupingSeparator symbol", dfs
+				.getGroupingSeparator() == '*');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#setInfinity(java.lang.String)
+	 */
+	public void test_setInfinityLjava_lang_String() {
+		dfs.setInfinity("&");
+		assertTrue("Returned incorrect Infinity symbol",
+				dfs.getInfinity() == "&");
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#setInternationalCurrencySymbol(java.lang.String)
+	 */
+	public void test_setInternationalCurrencySymbolLjava_lang_String() {
+		Locale locale = Locale.CANADA;
+		DecimalFormatSymbols dfs = ((DecimalFormat) NumberFormat
+				.getCurrencyInstance(locale)).getDecimalFormatSymbols();
+		Currency currency = Currency.getInstance("JPY");
+		dfs.setInternationalCurrencySymbol(currency.getCurrencyCode());
+
+		assertTrue("Test1: Returned incorrect currency", currency == dfs
+				.getCurrency());
+		assertTrue("Test1: Returned incorrect currency symbol", currency
+				.getSymbol(locale).equals(dfs.getCurrencySymbol()));
+		assertTrue("Test1: Returned incorrect international currency symbol",
+				currency.getCurrencyCode().equals(
+						dfs.getInternationalCurrencySymbol()));
+
+		String symbol = dfs.getCurrencySymbol();
+		dfs.setInternationalCurrencySymbol("bogus");
+		assertTrue("Test2: Returned incorrect currency",
+				dfs.getCurrency() == null);
+		assertTrue("Test2: Returned incorrect currency symbol", dfs
+				.getCurrencySymbol().equals(symbol));
+		assertTrue("Test2: Returned incorrect international currency symbol",
+				dfs.getInternationalCurrencySymbol().equals("bogus"));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#setMinusSign(char)
+	 */
+	public void test_setMinusSignC() {
+		dfs.setMinusSign('&');
+		assertTrue("Returned incorrect MinusSign symbol",
+				dfs.getMinusSign() == '&');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#setNaN(java.lang.String)
+	 */
+	public void test_setNaNLjava_lang_String() {
+		dfs.setNaN("NAN!!");
+		assertTrue("Returned incorrect nan symbol", dfs.getNaN()
+				.equals("NAN!!"));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#setPatternSeparator(char)
+	 */
+	public void test_setPatternSeparatorC() {
+		dfs.setPatternSeparator('X');
+		assertTrue("Returned incorrect PatternSeparator symbol", dfs
+				.getPatternSeparator() == 'X');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#setPercent(char)
+	 */
+	public void test_setPercentC() {
+		dfs.setPercent('*');
+		assertTrue("Returned incorrect Percent symbol", dfs.getPercent() == '*');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#setPerMill(char)
+	 */
+	public void test_setPerMillC() {
+		dfs.setPerMill('#');
+		assertTrue("Returned incorrect PerMill symbol", dfs.getPerMill() == '#');
+	}
+
+	/**
+	 * @tests java.text.DecimalFormatSymbols#setZeroDigit(char)
+	 */
+	public void test_setZeroDigitC() {
+		dfs.setZeroDigit('*');
+		assertTrue("Set incorrect ZeroDigit symbol", dfs.getZeroDigit() == '*');
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+		dfs = new DecimalFormatSymbols();
+		dfsUS = new DecimalFormatSymbols(new Locale("en", "us"));
+	}
+
+	/**
+	 * Tears down the fixture, for example, close a network connection. This
+	 * method is called after a test is executed.
+	 */
+	protected void tearDown() {
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/DecimalFormatTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/DecimalFormatTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/DecimalFormatTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/DecimalFormatTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,748 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.api.java.text;
+
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.NumberFormat;
+import java.text.ParsePosition;
+import java.util.Currency;
+import java.util.Locale;
+
+import tests.support.Support_BitSet;
+import tests.support.Support_DecimalFormat;
+
+public class DecimalFormatTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.text.DecimalFormat#DecimalFormat(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method java.text.DecimalFormat(java.lang.String)
+		// the constructor form that specifies a pattern is equal to the form
+		// constructed with no pattern and applying that pattern using the
+		// applyPattern call
+		DecimalFormat format = new DecimalFormat("'$'0000.0000");
+		DecimalFormat format1 = new DecimalFormat();
+		format1.applyPattern("'$'0000.0000");
+		assertTrue("Constructed format did not match applied format object",
+				format.equals(format1));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#applyPattern(java.lang.String)
+	 */
+	public void test_applyPatternLjava_lang_String() {
+		DecimalFormat format = new DecimalFormat("#.#");
+		assertTrue("Wrong pattern 1", format.toPattern().equals("#0.#"));
+		format = new DecimalFormat("#.");
+		assertTrue("Wrong pattern 2", format.toPattern().equals("#0."));
+		format = new DecimalFormat("#");
+		assertTrue("Wrong pattern 3", format.toPattern().equals("#"));
+		format = new DecimalFormat(".#");
+		assertTrue("Wrong pattern 4", format.toPattern().equals("#.0"));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#clone()
+	 */
+	public void test_clone() {
+		DecimalFormat format = new DecimalFormat("'$'0000.0000");
+		DecimalFormat format1 = (DecimalFormat) (format.clone());
+		// make sure the objects are equal
+		assertTrue("Object's clone isn't equal!", format.equals(format1));
+		// change the content of the clone and make sure it's not equal anymore
+		// verifies that it's data is now distinct from the original
+		format1.applyPattern("'$'0000.####");
+		assertTrue("Object's changed clone should not be equal!", !format
+				.equals(format1));
+	}
+
+	private void compare(String testName, String format, String expected) {
+		assertTrue(testName + " got: " + format + " expected: " + expected,
+				format.equals(expected));
+	}
+
+	private boolean compare(int count, String format, String expected) {
+		boolean result = format.equals(expected);
+		if (!result)
+			System.out.println("Failure test: " + count + " got: " + format
+					+ " expected: " + expected);
+		return result;
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#format(double, java.lang.StringBuffer,
+	 *        java.text.FieldPosition)
+	 */
+	public void test_formatDLjava_lang_StringBufferLjava_text_FieldPosition() {
+		new Support_DecimalFormat(
+				"test_formatDLjava_lang_StringBufferLjava_text_FieldPosition")
+				.t_format_with_FieldPosition();
+
+		int failCount = 0;
+		Support_BitSet failures = new Support_BitSet();
+
+		DecimalFormat df = new DecimalFormat("00.0#E0");
+		compare("00.0#E0: 0.0", df.format(0.0), "00.0E0");
+		compare("00.0#E0: 1.0", df.format(1.0), "10.0E-1");
+		compare("00.0#E0: 12.0", df.format(12.0), "12.0E0");
+		compare("00.0#E0: 123.0", df.format(123.0), "12.3E1");
+		compare("00.0#E0: 1234.0", df.format(1234.0), "12.34E2");
+		compare("00.0#E0: 12346.0", df.format(12346.0), "12.35E3");
+		compare("00.0#E0: 99999.0", df.format(99999.0), "10.0E4");
+		compare("00.0#E0: 1.2", df.format(1.2), "12.0E-1");
+		compare("00.0#E0: 12.3", df.format(12.3), "12.3E0");
+		compare("00.0#E0: 123.4", df.format(123.4), "12.34E1");
+		compare("00.0#E0: 1234.6", df.format(1234.6), "12.35E2");
+		compare("00.0#E0: 9999.9", df.format(9999.9), "10.0E3");
+		compare("00.0#E0: 0.1", df.format(0.1), "10.0E-2");
+		compare("00.0#E0: 0.12", df.format(0.12), "12.0E-2");
+		compare("00.0#E0: 0.123", df.format(0.123), "12.3E-2");
+		compare("00.0#E0: 0.1234", df.format(0.1234), "12.34E-2");
+		compare("00.0#E0: 0.12346", df.format(0.12346), "12.35E-2");
+		compare("00.0#E0: 0.99999", df.format(0.99999), "10.0E-1");
+		compare("00.0#E0: -0.0", df.format(-0.0), "-00.0E0");
+		compare("00.0#E0: -1.0", df.format(-1.0), "-10.0E-1");
+		compare("00.0#E0: -12.0", df.format(-12.0), "-12.0E0");
+		compare("00.0#E0: -123.0", df.format(-123.0), "-12.3E1");
+		compare("00.0#E0: -1234.0", df.format(-1234.0), "-12.34E2");
+		compare("00.0#E0: -12346.0", df.format(-12346.0), "-12.35E3");
+		compare("00.0#E0: -99999.0", df.format(-99999.0), "-10.0E4");
+
+		df = new DecimalFormat("##0.0E0");
+		compare("##0.0E0: -0.0", df.format(-0.0), "-0.0E0");
+		compare("##0.0E0: 0.0", df.format(0.0), "0.0E0");
+		compare("##0.0E0: 1.0", df.format(1.0), "1.0E0");
+		compare("##0.0E0: 12.0", df.format(12.0), "12E0");
+		compare("##0.0E0: 123.0", df.format(123.0), "123E0");
+		compare("##0.0E0: 1234.0", df.format(1234.0), "1.234E3");
+		compare("##0.0E0: 12346.0", df.format(12346.0), "12.35E3");
+		// Fails in JDK 1.2.2
+		if (!compare(failCount, df.format(99999.0), "100E3"))
+			failures.set(failCount);
+		failCount++;
+		compare("##0.0E0: 999999.0", df.format(999999.0), "1.0E6");
+
+		df = new DecimalFormat("#00.0##E0");
+		compare("#00.0##E0: 0.1", df.format(0.1), ".100E0");
+		compare("#00.0##E0: 0.12", df.format(0.12), ".120E0");
+		compare("#00.0##E0: 0.123", df.format(0.123), ".123E0");
+		compare("#00.0##E0: 0.1234", df.format(0.1234), ".1234E0");
+		compare("#00.0##E0: 0.1234567", df.format(0.1234567), ".123457E0");
+		compare("#00.0##E0: 0.01", df.format(0.01), "10.0E-3");
+		compare("#00.0##E0: 0.012", df.format(0.012), "12.0E-3");
+		compare("#00.0##E0: 0.0123", df.format(0.0123), "12.3E-3");
+		compare("#00.0##E0: 0.01234", df.format(0.01234), "12.34E-3");
+		compare("#00.0##E0: 0.01234567", df.format(0.01234567), "12.3457E-3");
+		compare("#00.0##E0: 0.001", df.format(0.001), "1.00E-3");
+		compare("#00.0##E0: 0.0012", df.format(0.0012), "1.20E-3");
+		compare("#00.0##E0: 0.00123", df.format(0.00123), "1.23E-3");
+		compare("#00.0##E0: 0.001234", df.format(0.001234), "1.234E-3");
+		compare("#00.0##E0: 0.001234567", df.format(0.001234567), "1.23457E-3");
+		compare("#00.0##E0: 0.0001", df.format(0.0001), "100E-6");
+		compare("#00.0##E0: 0.00012", df.format(0.00012), "120E-6");
+		compare("#00.0##E0: 0.000123", df.format(0.000123), "123E-6");
+		compare("#00.0##E0: 0.0001234", df.format(0.0001234), "123.4E-6");
+		compare("#00.0##E0: 0.0001234567", df.format(0.0001234567),
+				"123.457E-6");
+
+		// Fails in JDK 1.2.2
+		if (!compare(failCount, df.format(0.0), "0.00E0"))
+			failures.set(failCount);
+		failCount++;
+		compare("#00.0##E0: 1.0", df.format(1.0), "1.00E0");
+		compare("#00.0##E0: 12.0", df.format(12.0), "12.0E0");
+		compare("#00.0##E0: 123.0", df.format(123.0), "123E0");
+		compare("#00.0##E0: 1234.0", df.format(1234.0), "1.234E3");
+		compare("#00.0##E0: 12345.0", df.format(12345.0), "12.345E3");
+		compare("#00.0##E0: 123456.0", df.format(123456.0), "123.456E3");
+		compare("#00.0##E0: 1234567.0", df.format(1234567.0), "1.23457E6");
+		compare("#00.0##E0: 12345678.0", df.format(12345678.0), "12.3457E6");
+		compare("#00.0##E0: 99999999.0", df.format(99999999.0), "100E6");
+
+		df = new DecimalFormat("#.0E0");
+		compare("#.0E0: -0.0", df.format(-0.0), "-.0E0");
+		compare("#.0E0: 0.0", df.format(0.0), ".0E0");
+		compare("#.0E0: 1.0", df.format(1.0), ".1E1");
+		compare("#.0E0: 12.0", df.format(12.0), ".12E2");
+		compare("#.0E0: 123.0", df.format(123.0), ".12E3");
+		compare("#.0E0: 1234.0", df.format(1234.0), ".12E4");
+		compare("#.0E0: 9999.0", df.format(9999.0), ".1E5");
+
+		df = new DecimalFormat("0.#E0");
+		compare("0.#E0: -0.0", df.format(-0.0), "-0E0");
+		compare("0.#E0: 0.0", df.format(0.0), "0E0");
+		compare("0.#E0: 1.0", df.format(1.0), "1E0");
+		compare("0.#E0: 12.0", df.format(12.0), "1.2E1");
+		compare("0.#E0: 123.0", df.format(123.0), "1.2E2");
+		compare("0.#E0: 1234.0", df.format(1234.0), "1.2E3");
+		compare("0.#E0: 9999.0", df.format(9999.0), "1E4");
+
+		df = new DecimalFormat(".0E0");
+		compare(".0E0: -0.0", df.format(-0.0), "-.0E0");
+		compare(".0E0: 0.0", df.format(0.0), ".0E0");
+		compare(".0E0: 1.0", df.format(1.0), ".1E1");
+		compare(".0E0: 12.0", df.format(12.0), ".1E2");
+		compare(".0E0: 123.0", df.format(123.0), ".1E3");
+		compare(".0E0: 1234.0", df.format(1234.0), ".1E4");
+		compare(".0E0: 9999.0", df.format(9999.0), ".1E5");
+
+		df = new DecimalFormat("0.E0");
+		// Fails in JDK 1.2.2
+		if (!compare(failCount, df.format(0.0), "0.E0"))
+			failures.set(failCount);
+		failCount++;
+		if (!compare(failCount, df.format(1.0), "1.E0"))
+			failures.set(failCount);
+		failCount++;
+		if (!compare(failCount, df.format(12.0), "1.E1"))
+			failures.set(failCount);
+		failCount++;
+		if (!compare(failCount, df.format(123.0), "1.E2"))
+			failures.set(failCount);
+		failCount++;
+		if (!compare(failCount, df.format(1234.0), "1.E3"))
+			failures.set(failCount);
+		failCount++;
+		if (!compare(failCount, df.format(9999.0), "1.E4"))
+			failures.set(failCount);
+		failCount++;
+
+		df = new DecimalFormat("##0.00#E0");
+		compare("##0.00#E0: 0.1", df.format(0.1), ".100E0");
+		compare("##0.00#E0: 0.1234567", df.format(0.1234567), ".123457E0");
+		compare("##0.00#E0: 0.9999999", df.format(0.9999999), "1.00E0");
+		compare("##0.00#E0: 0.01", df.format(0.01), "10.0E-3");
+		compare("##0.00#E0: 0.01234567", df.format(0.01234567), "12.3457E-3");
+		compare("##0.00#E0: 0.09999999", df.format(0.09999999), ".100E0");
+		compare("##0.00#E0: 0.001", df.format(0.001), "1.00E-3");
+		compare("##0.00#E0: 0.001234567", df.format(0.001234567), "1.23457E-3");
+		compare("##0.00#E0: 0.009999999", df.format(0.009999999), "10.0E-3");
+		compare("##0.00#E0: 0.0001", df.format(0.0001), "100E-6");
+		compare("##0.00#E0: 0.0001234567", df.format(0.0001234567),
+				"123.457E-6");
+		compare("##0.00#E0: 0.0009999999", df.format(0.0009999999), "1.00E-3");
+
+		df = new DecimalFormat("###0.00#E0");
+		compare("###0.00#E0: 0.1", df.format(0.1), ".100E0");
+		compare("###0.00#E0: 0.12345678", df.format(0.12345678), ".1234568E0");
+		compare("###0.00#E0: 0.99999999", df.format(0.99999999), "1.00E0");
+		compare("###0.00#E0: 0.01", df.format(0.01), "100E-4");
+		compare("###0.00#E0: 0.012345678", df.format(0.012345678),
+				"123.4568E-4");
+		compare("###0.00#E0: 0.099999999", df.format(0.099999999), ".100E0");
+		compare("###0.00#E0: 0.001", df.format(0.001), "10.0E-4");
+		compare("###0.00#E0: 0.0012345678", df.format(0.0012345678),
+				"12.34568E-4");
+		compare("###0.00#E0: 0.0099999999", df.format(0.0099999999), "100E-4");
+		compare("###0.00#E0: 0.0001", df.format(0.0001), "1.00E-4");
+		compare("###0.00#E0: 0.00012345678", df.format(0.00012345678),
+				"1.234568E-4");
+		compare("###0.00#E0: 0.00099999999", df.format(0.00099999999),
+				"10.0E-4");
+		// Fails in JDK 1.2.2
+		if (!compare(failCount, df.format(0.00001), "1000E-8"))
+			failures.set(failCount);
+		failCount++;
+		compare("###0.00#E0: 0.000012345678", df.format(0.000012345678),
+				"1234.568E-8");
+		compare("###0.00#E0: 0.000099999999", df.format(0.000099999999),
+				"1.00E-4");
+
+		df = new DecimalFormat("###0.0#E0");
+		compare("###0.0#E0: 0.1", df.format(0.1), ".10E0");
+		compare("###0.0#E0: 0.1234567", df.format(0.1234567), ".123457E0");
+		compare("###0.0#E0: 0.9999999", df.format(0.9999999), "1.0E0");
+		// Fails in JDK 1.2.2
+		if (!compare(failCount, df.format(0.01), "100E-4"))
+			failures.set(failCount);
+		failCount++;
+		compare("###0.0#E0: 0.01234567", df.format(0.01234567), "123.457E-4");
+		compare("###0.0#E0: 0.09999999", df.format(0.09999999), ".10E0");
+		compare("###0.0#E0: 0.001", df.format(0.001), "10E-4");
+		compare("###0.0#E0: 0.001234567", df.format(0.001234567), "12.3457E-4");
+		// Fails in JDK 1.2.2
+		if (!compare(failCount, df.format(0.009999999), "100E-4"))
+			failures.set(failCount);
+		failCount++;
+		compare("###0.0#E0: 0.0001", df.format(0.0001), "1.0E-4");
+		compare("###0.0#E0: 0.0001234567", df.format(0.0001234567),
+				"1.23457E-4");
+		compare("###0.0#E0: 0.0009999999", df.format(0.0009999999), "10E-4");
+		// Fails in JDK 1.2.2
+		if (!compare(failCount, df.format(0.00001), "1000E-8"))
+			failures.set(failCount);
+		failCount++;
+		compare("###0.0#E0: 0.00001234567", df.format(0.00001234567),
+				"1234.57E-8");
+		compare("###0.0#E0: 0.00009999999", df.format(0.00009999999), "1.0E-4");
+
+		assertTrue("Failed " + failures + " of " + failCount,
+				failures.length() == 0);
+
+		String formatString = "##0.#";
+		df = new DecimalFormat(formatString);
+		df.setMinimumFractionDigits(30);
+		compare(formatString + ": 0.000000000000000000000000000000", df
+				.format(0.0), "0.000000000000000000000000000000");
+		compare(formatString + ": -0.000000000000000000000000000000", df
+				.format(-0.0), "-0.000000000000000000000000000000");
+		compare(formatString + ": 1.000000000000000000000000000000", df
+				.format(1.0), "1.000000000000000000000000000000");
+		compare(formatString + ": -1.000000000000000000000000000000", df
+				.format(-1.0), "-1.000000000000000000000000000000");
+
+		df = new DecimalFormat(formatString);
+		df.setMaximumFractionDigits(30);
+		compare(formatString + ": 0", df.format(0.0), "0");
+		compare(formatString + ": -0", df.format(-0.0), "-0");
+		compare(formatString + ": 1", df.format(1.0), "1");
+		compare(formatString + ": -1", df.format(-1.0), "-1");
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#format(long, java.lang.StringBuffer,
+	 *        java.text.FieldPosition)
+	 */
+	public void test_formatJLjava_lang_StringBufferLjava_text_FieldPosition() {
+		int failCount = 0;
+		Support_BitSet failures = new Support_BitSet();
+
+		DecimalFormat df = new DecimalFormat("00.0#E0");
+		assertTrue("00.0#E0: 0", df.format(0).equals("00.0E0"));
+		assertTrue("00.0#E0: 1", df.format(1).equals("10.0E-1"));
+		assertTrue("00.0#E0: 12", df.format(12).equals("12.0E0"));
+		assertTrue("00.0#E0: 123", df.format(123).equals("12.3E1"));
+		assertTrue("00.0#E0: 1234", df.format(1234).equals("12.34E2"));
+		assertTrue("00.0#E0: 12346", df.format(12346).equals("12.35E3"));
+		assertTrue("00.0#E0: 99999", df.format(99999).equals("10.0E4"));
+		assertTrue("00.0#E0: -1", df.format(-1).equals("-10.0E-1"));
+		assertTrue("00.0#E0: -12", df.format(-12).equals("-12.0E0"));
+		assertTrue("00.0#E0: -123", df.format(-123).equals("-12.3E1"));
+		assertTrue("00.0#E0: -1234", df.format(-1234).equals("-12.34E2"));
+		assertTrue("00.0#E0: -12346", df.format(-12346).equals("-12.35E3"));
+		assertTrue("00.0#E0: -99999", df.format(-99999).equals("-10.0E4"));
+
+		df = new DecimalFormat("##0.0E0");
+		assertTrue("##0.0E0: 0", df.format(0).equals("0.0E0"));
+		assertTrue("##0.0E0: 1", df.format(1).equals("1.0E0"));
+		assertTrue("##0.0E0: 12", df.format(12).equals("12E0"));
+		assertTrue("##0.0E0: 123", df.format(123).equals("123E0"));
+		assertTrue("##0.0E0: 1234", df.format(1234).equals("1.234E3"));
+		assertTrue("##0.0E0: 12346", df.format(12346).equals("12.35E3"));
+		// Fails in JDK 1.2.2
+		if (!df.format(99999).equals("100E3"))
+			failures.set(failCount);
+		failCount++;
+		assertTrue("##0.0E0: 999999", df.format(999999).equals("1.0E6"));
+
+		df = new DecimalFormat("#00.0##E0");
+		// Fails in JDK 1.2.2
+		if (!df.format(0).equals("0.00E0"))
+			failures.set(failCount);
+		failCount++;
+		assertTrue("#00.0##E0: 1", df.format(1).equals("1.00E0"));
+		assertTrue("#00.0##E0: 12", df.format(12).equals("12.0E0"));
+		assertTrue("#00.0##E0: 123", df.format(123).equals("123E0"));
+		assertTrue("#00.0##E0: 1234", df.format(1234).equals("1.234E3"));
+		assertTrue("#00.0##E0: 12345", df.format(12345).equals("12.345E3"));
+		assertTrue("#00.0##E0: 123456", df.format(123456).equals("123.456E3"));
+		assertTrue("#00.0##E0: 1234567", df.format(1234567).equals("1.23457E6"));
+		assertTrue("#00.0##E0: 12345678", df.format(12345678).equals(
+				"12.3457E6"));
+		assertTrue("#00.0##E0: 99999999", df.format(99999999).equals("100E6"));
+
+		df = new DecimalFormat("#.0E0");
+		assertTrue("#.0E0: 0", df.format(0).equals(".0E0"));
+		assertTrue("#.0E0: 1", df.format(1).equals(".1E1"));
+		assertTrue("#.0E0: 12", df.format(12).equals(".12E2"));
+		assertTrue("#.0E0: 123", df.format(123).equals(".12E3"));
+		assertTrue("#.0E0: 1234", df.format(1234).equals(".12E4"));
+		assertTrue("#.0E0: 9999", df.format(9999).equals(".1E5"));
+
+		df = new DecimalFormat("0.#E0");
+		assertTrue("0.#E0: 0", df.format(0).equals("0E0"));
+		assertTrue("0.#E0: 1", df.format(1).equals("1E0"));
+		assertTrue("0.#E0: 12", df.format(12).equals("1.2E1"));
+		assertTrue("0.#E0: 123", df.format(123).equals("1.2E2"));
+		assertTrue("0.#E0: 1234", df.format(1234).equals("1.2E3"));
+		assertTrue("0.#E0: 9999", df.format(9999).equals("1E4"));
+
+		assertTrue("Failed " + failures + " of " + failCount,
+				failures.length() == 0);
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#formatToCharacterIterator(java.lang.Object)
+	 */
+	public void test_formatToCharacterIteratorLjava_lang_Object() {
+		new Support_DecimalFormat(
+				"test_formatToCharacterIteratorLjava_lang_Object")
+				.t_formatToCharacterIterator();
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#format(double)
+	 */
+	public void test_formatD() {
+		DecimalFormat format = (DecimalFormat) NumberFormat
+				.getInstance(Locale.ENGLISH);
+		format.setGroupingUsed(false);
+		format.setMaximumFractionDigits(400);
+		for (int i = 0; i < 309; i++) {
+			String tval = "1";
+			for (int j = 0; j < i; j++)
+				tval += "0";
+			double d = Double.parseDouble(tval);
+			String result = format.format(d);
+			assertEquals(i + ") e:" + tval + " r:" + result, tval, result);
+		}
+		for (int i = 0; i < 322; i++) {
+			String tval = "0.";
+			for (int j = 0; j < i; j++)
+				tval += "0";
+			tval += "1";
+			double d = Double.parseDouble(tval);
+			String result = format.format(d);
+			assertEquals(i + ") e:" + tval + " r:" + result, tval, result);
+		}
+		assertEquals("999999999999999", format.format(999999999999999.));
+		assertEquals("1", "999999999999999.9", format.format(999999999999999.9));
+		assertEquals("2", "99999999999999.98", format.format(99999999999999.99));
+		assertEquals("3", "9999999999999.998", format.format(9999999999999.999));
+		assertEquals("4", "999999999999.9999", format.format(999999999999.9999));
+		assertEquals("5", "99999999999.99998", format.format(99999999999.99999));
+		assertEquals("6", "9999999999.999998", format.format(9999999999.999999));
+		assertEquals("7", "999999999.9999999", format.format(999999999.9999999));
+		assertEquals("8", "99999999.99999999", format.format(99999999.99999999));
+		assertEquals("9", "9999999.999999998", format.format(9999999.999999999));
+		assertEquals("10", "99999.99999999999", format
+				.format(99999.99999999999));
+		assertEquals("11", "9999.999999999998", format
+				.format(9999.999999999999));
+		assertEquals("12", "999.9999999999999", format
+				.format(999.9999999999999));
+		assertEquals("13", "99.99999999999999", format
+				.format(99.99999999999999));
+		assertEquals("14", "9.999999999999998", format
+				.format(9.999999999999999));
+		assertEquals("15", "0.9999999999999999", format
+				.format(.9999999999999999));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#getDecimalFormatSymbols()
+	 */
+	public void test_getDecimalFormatSymbols() {
+		DecimalFormat df = (DecimalFormat) NumberFormat
+				.getInstance(Locale.ENGLISH);
+		DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
+		assertTrue("Identical symbols", dfs != df.getDecimalFormatSymbols());
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#getCurrency()
+	 */
+	public void test_getCurrency() {
+		Currency currK = Currency.getInstance("KRW");
+		Currency currX = Currency.getInstance("XXX");
+		Currency currE = Currency.getInstance("EUR");
+		//Currency currF = Currency.getInstance("FRF");
+
+		DecimalFormat df = (DecimalFormat) NumberFormat
+				.getCurrencyInstance(new Locale("ko", "KR"));
+		assertTrue("Test1: Returned incorrect currency",
+				df.getCurrency() == currK);
+
+		df = (DecimalFormat) NumberFormat.getCurrencyInstance(new Locale("",
+				"KR"));
+		assertTrue("Test2: Returned incorrect currency",
+				df.getCurrency() == currK);
+
+		df = (DecimalFormat) NumberFormat.getCurrencyInstance(new Locale("ko",
+				""));
+		assertTrue("Test3: Returned incorrect currency",
+				df.getCurrency() == currX);
+
+		df = (DecimalFormat) NumberFormat.getCurrencyInstance(new Locale("fr",
+				"FR"));
+		assertTrue("Test4: Returned incorrect currency",
+				df.getCurrency() == currE);
+
+		// JDK fails these tests since it doesn't have the PREEURO variant
+		// df = (DecimalFormat)NumberFormat.getCurrencyInstance(new Locale("fr",
+		// "FR","PREEURO"));
+		// assertTrue("Test5: Returned incorrect currency", df.getCurrency() ==
+		// currF);
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#getGroupingSize()
+	 */
+	public void test_getGroupingSize() {
+		DecimalFormat df = new DecimalFormat("###0.##");
+		assertTrue("Wrong unset size", df.getGroupingSize() == 0);
+		df = new DecimalFormat("#,##0.##");
+		assertTrue("Wrong set size", df.getGroupingSize() == 3);
+		df = new DecimalFormat("#,###,###0.##");
+		assertTrue("Wrong multiple set size", df.getGroupingSize() == 4);
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#getMultiplier()
+	 */
+	public void test_getMultiplier() {
+		DecimalFormat df = new DecimalFormat("###0.##");
+		assertTrue("Wrong unset multiplier", df.getMultiplier() == 1);
+		df = new DecimalFormat("###0.##%");
+		assertTrue("Wrong percent multiplier", df.getMultiplier() == 100);
+		df = new DecimalFormat("###0.##\u2030");
+		assertTrue("Wrong mille multiplier", df.getMultiplier() == 1000);
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#isDecimalSeparatorAlwaysShown()
+	 */
+	public void test_isDecimalSeparatorAlwaysShown() {
+		DecimalFormat df = new DecimalFormat("###0.##");
+		assertTrue("Wrong unset value", !df.isDecimalSeparatorAlwaysShown());
+		df = new DecimalFormat("###0.00");
+		assertTrue("Wrong unset2 value", !df.isDecimalSeparatorAlwaysShown());
+		df = new DecimalFormat("###0.");
+		assertTrue("Wrong set value", df.isDecimalSeparatorAlwaysShown());
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#parse(java.lang.String,
+	 *        java.text.ParsePosition)
+	 */
+	public void test_parseLjava_lang_StringLjava_text_ParsePosition() {
+		DecimalFormat format = (DecimalFormat) NumberFormat
+				.getNumberInstance(Locale.ENGLISH);
+		ParsePosition pos = new ParsePosition(0);
+		Number result = format.parse("9223372036854775807", pos);
+		assertTrue("Wrong result type for Long.MAX_VALUE",
+				result.getClass() == Long.class);
+		assertTrue("Wrong result Long.MAX_VALUE",
+				result.longValue() == Long.MAX_VALUE);
+		pos = new ParsePosition(0);
+		result = format.parse("-9223372036854775808", pos);
+		assertTrue("Wrong result type for Long.MIN_VALUE",
+				result.getClass() == Long.class);
+		assertTrue("Wrong result Long.MIN_VALUE: " + result.longValue(), result
+				.longValue() == Long.MIN_VALUE);
+		pos = new ParsePosition(0);
+		result = format.parse("9223372036854775808", pos);
+		assertTrue("Wrong result type for Long.MAX_VALUE+1",
+				result.getClass() == Double.class);
+		assertTrue("Wrong result Long.MAX_VALUE + 1",
+				result.doubleValue() == (double) Long.MAX_VALUE + 1);
+		pos = new ParsePosition(0);
+		result = format.parse("-9223372036854775809", pos);
+		assertTrue("Wrong result type for Long.MIN_VALUE+1",
+				result.getClass() == Double.class);
+		assertTrue("Wrong result Long.MIN_VALUE - 1",
+				result.doubleValue() == (double) Long.MIN_VALUE - 1);
+
+		pos = new ParsePosition(0);
+		result = format.parse("18446744073709551629", pos);
+		assertTrue("Wrong result type for overflow",
+				result.getClass() == Double.class);
+		assertTrue("Wrong result for overflow",
+				result.doubleValue() == 18446744073709551629d);
+
+		pos = new ParsePosition(0);
+		result = format.parse("42325917317067571199", pos);
+		assertTrue("Wrong result type for overflow a: " + result, result
+				.getClass() == Double.class);
+		assertTrue("Wrong result for overflow a: " + result, result
+				.doubleValue() == 42325917317067571199d);
+		pos = new ParsePosition(0);
+		result = format.parse("4232591731706757119E1", pos);
+		assertTrue("Wrong result type for overflow b: " + result, result
+				.getClass() == Double.class);
+		assertTrue("Wrong result for overflow b: " + result, result
+				.doubleValue() == 42325917317067571190d);
+		pos = new ParsePosition(0);
+		result = format.parse(".42325917317067571199E20", pos);
+		assertTrue("Wrong result type for overflow c: " + result, result
+				.getClass() == Double.class);
+		assertTrue("Wrong result for overflow c: " + result, result
+				.doubleValue() == 42325917317067571199d);
+		pos = new ParsePosition(0);
+		result = format.parse("922337203685477580.9E1", pos);
+		assertTrue("Wrong result type for overflow d: " + result, result
+				.getClass() == Double.class);
+		assertTrue("Wrong result for overflow d: " + result, result
+				.doubleValue() == 9223372036854775809d);
+		pos = new ParsePosition(0);
+		result = format.parse("9.223372036854775809E18", pos);
+		assertTrue("Wrong result type for overflow e: " + result, result
+				.getClass() == Double.class);
+		assertTrue("Wrong result for overflow e: " + result, result
+				.doubleValue() == 9223372036854775809d);
+
+		// test parse with multipliers
+		format.setMultiplier(100);
+		result = format.parse("9223372036854775807", new ParsePosition(0));
+		assertTrue("Wrong result type multiplier 100: " + result, result
+				.getClass() == Long.class);
+		assertTrue("Wrong result for multiplier 100: " + result, result
+				.longValue() == 92233720368547758L);
+
+		format.setMultiplier(1000);
+		result = format.parse("9223372036854775807", new ParsePosition(0));
+		assertTrue("Wrong result type multiplier 1000: " + result, result
+				.getClass() == Long.class);
+		assertTrue("Wrong result for multiplier 1000: " + result, result
+				.longValue() == 9223372036854776L);
+
+		format.setMultiplier(10000);
+		result = format.parse("9223372036854775807", new ParsePosition(0));
+		assertTrue("Wrong result type multiplier 10000: " + result, result
+				.getClass() == Double.class);
+		assertTrue("Wrong result for multiplier 10000: " + result, result
+				.doubleValue() == 922337203685477.5807d);
+
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#setDecimalFormatSymbols(java.text.DecimalFormatSymbols)
+	 */
+	public void test_setDecimalFormatSymbolsLjava_text_DecimalFormatSymbols() {
+		DecimalFormat df = new DecimalFormat("###0.##");
+		DecimalFormatSymbols dfs = new DecimalFormatSymbols();
+		dfs.setDecimalSeparator('@');
+		df.setDecimalFormatSymbols(dfs);
+		assertTrue("Not set", df.getDecimalFormatSymbols().equals(dfs));
+		assertTrue("Symbols not used", df.format(1.2).equals("1@2"));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#setDecimalSeparatorAlwaysShown(boolean)
+	 */
+	public void test_setDecimalSeparatorAlwaysShownZ() {
+		DecimalFormat df = new DecimalFormat("###0.##");
+		assertTrue("Wrong default result", df.format(5).equals("5"));
+		df.setDecimalSeparatorAlwaysShown(true);
+		assertTrue("Not set", df.isDecimalSeparatorAlwaysShown());
+		assertTrue("Wrong set result", df.format(7).equals("7."));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#setCurrency(java.util.Currency)
+	 */
+	public void test_setCurrencyLjava_util_Currency() {
+		Locale locale = Locale.CANADA;
+		DecimalFormat df = ((DecimalFormat) NumberFormat
+				.getCurrencyInstance(locale));
+
+		try {
+			df.setCurrency(null);
+			fail("Expected NullPointerException");
+		} catch (NullPointerException e) {
+		}
+
+		Currency currency = Currency.getInstance("AED");
+		df.setCurrency(currency);
+		assertTrue("Returned incorrect currency", currency == df.getCurrency());
+		assertTrue("Returned incorrect currency symbol", currency.getSymbol(
+				locale)
+				.equals(df.getDecimalFormatSymbols().getCurrencySymbol()));
+		assertTrue("Returned incorrect international currency symbol", currency
+				.getCurrencyCode().equals(
+						df.getDecimalFormatSymbols()
+								.getInternationalCurrencySymbol()));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#setGroupingSize(int)
+	 */
+	public void test_setGroupingSizeI() {
+		DecimalFormat df = new DecimalFormat("###0.##",
+				new DecimalFormatSymbols(Locale.ENGLISH));
+		df.setGroupingUsed(true);
+		df.setGroupingSize(2);
+		assertTrue("Value not set", df.getGroupingSize() == 2);
+		String result = df.format(123);
+		assertTrue("Invalid format:" + result, result.equals("1,23"));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#setMaximumFractionDigits(int)
+	 */
+	public void test_setMaximumFractionDigitsI() {
+		DecimalFormat df = new DecimalFormat("###0.##");
+		df.setMaximumFractionDigits(3);
+		assertTrue("Not set", df.getMaximumFractionDigits() == 3);
+		assertTrue("Wrong maximum", df.format(1.23456).equals("1.235"));
+		df.setMinimumFractionDigits(4);
+		assertTrue("Not changed", df.getMaximumFractionDigits() == 4);
+		assertTrue("Incorrect fraction", df.format(456).equals("456.0000"));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#setMaximumIntegerDigits(int)
+	 */
+	public void test_setMaximumIntegerDigitsI() {
+		DecimalFormat df = new DecimalFormat("###0.##");
+		df.setMaximumIntegerDigits(2);
+		assertTrue("Not set", df.getMaximumIntegerDigits() == 2);
+		assertTrue("Wrong maximum", df.format(1234).equals("34"));
+		df.setMinimumIntegerDigits(4);
+		assertTrue("Not changed", df.getMaximumIntegerDigits() == 4);
+		assertTrue("Incorrect integer", df.format(26).equals("0026"));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#setMinimumFractionDigits(int)
+	 */
+	public void test_setMinimumFractionDigitsI() {
+		DecimalFormat df = new DecimalFormat("###0.##");
+		df.setMinimumFractionDigits(4);
+		assertTrue("Not set", df.getMinimumFractionDigits() == 4);
+		assertTrue("Wrong minimum", df.format(1.23).equals("1.2300"));
+		df.setMaximumFractionDigits(2);
+		assertTrue("Not changed", df.getMinimumFractionDigits() == 2);
+		assertTrue("Incorrect fraction", df.format(456).equals("456.00"));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#setMinimumIntegerDigits(int)
+	 */
+	public void test_setMinimumIntegerDigitsI() {
+		DecimalFormat df = new DecimalFormat("###0.##");
+		df.setMinimumIntegerDigits(3);
+		assertTrue("Not set", df.getMinimumIntegerDigits() == 3);
+		assertTrue("Wrong minimum", df.format(12).equals("012"));
+		df.setMaximumIntegerDigits(2);
+		assertTrue("Not changed", df.getMinimumIntegerDigits() == 2);
+		assertTrue("Incorrect integer", df.format(0.7).equals("00.7"));
+	}
+
+	/**
+	 * @tests java.text.DecimalFormat#setMultiplier(int)
+	 */
+	public void test_setMultiplierI() {
+		DecimalFormat df = new DecimalFormat("###0.##");
+		df.setMultiplier(10);
+		assertTrue("Wrong multiplier", df.getMultiplier() == 10);
+		assertTrue("Wrong format", df.format(5).equals("50"));
+		assertTrue("Wrong parse", df.parse("50", new ParsePosition(0))
+				.intValue() == 5);
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/FieldPositionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/FieldPositionTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/FieldPositionTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/FieldPositionTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,237 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package tests.api.java.text;
+
+import java.text.DateFormat;
+import java.text.FieldPosition;
+
+public class FieldPositionTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.text.FieldPosition#FieldPosition(int)
+	 */
+	public void test_ConstructorI() {
+		// Test for constructor java.text.FieldPosition(int)
+		FieldPosition fpos = new FieldPosition(DateFormat.MONTH_FIELD);
+		assertEquals("Test1: Constructor failed to set field identifier!",
+				DateFormat.MONTH_FIELD, fpos.getField());
+		assertEquals("Constructor failed to set field attribute!", null, fpos
+				.getFieldAttribute());
+	}
+
+	/**
+	 * @tests java.text.FieldPosition#FieldPosition(java.text.Format$Field)
+	 */
+	public void test_ConstructorLjava_text_Format$Field() {
+		// Test for constructor java.text.FieldPosition(Format.Field)
+		FieldPosition fpos = new FieldPosition(DateFormat.Field.MONTH);
+		assertSame("Constructor failed to set field attribute!",
+				DateFormat.Field.MONTH, fpos.getFieldAttribute());
+		assertEquals("Test1: Constructor failed to set field identifier!", -1,
+				fpos.getField());
+	}
+
+	/**
+	 * @tests java.text.FieldPosition#FieldPosition(java.text.Format$Field, int)
+	 */
+	public void test_ConstructorLjava_text_Format$FieldI() {
+		// Test for constructor java.text.FieldPosition(Format.Field, int)
+		FieldPosition fpos = new FieldPosition(DateFormat.Field.MONTH,
+				DateFormat.MONTH_FIELD);
+		assertSame("Constructor failed to set field attribute!",
+				DateFormat.Field.MONTH, fpos.getFieldAttribute());
+		assertEquals("Test1: Constructor failed to set field identifier!",
+				DateFormat.MONTH_FIELD, fpos.getField());
+
+		// test special cases
+		FieldPosition fpos2 = new FieldPosition(DateFormat.Field.HOUR1,
+				DateFormat.HOUR1_FIELD);
+		assertSame("Constructor failed to set field attribute!",
+				DateFormat.Field.HOUR1, fpos2.getFieldAttribute());
+		assertEquals("Test2: Constructor failed to set field identifier!",
+				DateFormat.HOUR1_FIELD, fpos2.getField());
+
+		FieldPosition fpos3 = new FieldPosition(DateFormat.Field.TIME_ZONE,
+				DateFormat.MONTH_FIELD);
+		assertSame("Constructor failed to set field attribute!",
+				DateFormat.Field.TIME_ZONE, fpos3.getFieldAttribute());
+		assertEquals("Test3: Constructor failed to set field identifier!",
+				DateFormat.MONTH_FIELD, fpos3.getField());
+	}
+
+	/**
+	 * @tests java.text.FieldPosition#equals(java.lang.Object)
+	 */
+	public void test_equalsLjava_lang_Object() {
+		// Test for method boolean
+		// java.text.FieldPosition.equals(java.lang.Object)
+		FieldPosition fpos = new FieldPosition(1);
+		FieldPosition fpos1 = new FieldPosition(1);
+		assertTrue("Identical objects were not equal!", fpos.equals(fpos1));
+
+		FieldPosition fpos2 = new FieldPosition(2);
+		assertTrue("Objects with a different ID should not be equal!", !fpos
+				.equals(fpos2));
+
+		fpos.setBeginIndex(1);
+		fpos1.setBeginIndex(2);
+		assertTrue("Objects with a different beginIndex were still equal!",
+				!fpos.equals(fpos1));
+		fpos1.setBeginIndex(1);
+		fpos1.setEndIndex(2);
+		assertTrue("Objects with a different endIndex were still equal!", !fpos
+				.equals(fpos1));
+
+		FieldPosition fpos3 = new FieldPosition(DateFormat.Field.ERA, 1);
+		assertTrue("Objects with a different attribute should not be equal!",
+				!fpos.equals(fpos3));
+		FieldPosition fpos4 = new FieldPosition(DateFormat.Field.AM_PM, 1);
+		assertTrue("Objects with a different attribute should not be equal!",
+				!fpos3.equals(fpos4));
+	}
+
+	/**
+	 * @tests java.text.FieldPosition#getBeginIndex()
+	 */
+	public void test_getBeginIndex() {
+		// Test for method int java.text.FieldPosition.getBeginIndex()
+		FieldPosition fpos = new FieldPosition(1);
+		fpos.setEndIndex(3);
+		fpos.setBeginIndex(2);
+		assertTrue("getBeginIndex should have returned 2",
+				fpos.getBeginIndex() == 2);
+	}
+
+	/**
+	 * @tests java.text.FieldPosition#getEndIndex()
+	 */
+	public void test_getEndIndex() {
+		// Test for method int java.text.FieldPosition.getEndIndex()
+		FieldPosition fpos = new FieldPosition(1);
+		fpos.setBeginIndex(2);
+		fpos.setEndIndex(3);
+		assertTrue("getEndIndex should have returned 3",
+				fpos.getEndIndex() == 3);
+	}
+
+	/**
+	 * @tests java.text.FieldPosition#getField()
+	 */
+	public void test_getField() {
+		// Test for method int java.text.FieldPosition.getField()
+		FieldPosition fpos = new FieldPosition(65);
+		assertTrue(
+				"FieldPosition(65) should have caused getField to return 65",
+				fpos.getField() == 65);
+		FieldPosition fpos2 = new FieldPosition(DateFormat.Field.MINUTE);
+		assertTrue(
+				"FieldPosition(DateFormat.Field.MINUTE) should have caused getField to return -1",
+				fpos2.getField() == -1);
+	}
+
+	/**
+	 * @tests java.text.FieldPosition#getFieldAttribute()
+	 */
+	public void test_getFieldAttribute() {
+		// Test for method int java.text.FieldPosition.getFieldAttribute()
+		FieldPosition fpos = new FieldPosition(DateFormat.Field.TIME_ZONE);
+		assertTrue(
+				"FieldPosition(DateFormat.Field.TIME_ZONE) should have caused getFieldAttribute to return DateFormat.Field.TIME_ZONE",
+				fpos.getFieldAttribute() == DateFormat.Field.TIME_ZONE);
+
+		FieldPosition fpos2 = new FieldPosition(DateFormat.TIMEZONE_FIELD);
+		assertTrue(
+				"FieldPosition(DateFormat.TIMEZONE_FIELD) should have caused getFieldAttribute to return null",
+				fpos2.getFieldAttribute() == null);
+	}
+
+	/**
+	 * @tests java.text.FieldPosition#hashCode()
+	 */
+	public void test_hashCode() {
+		// Test for method int java.text.FieldPosition.hashCode()
+		FieldPosition fpos = new FieldPosition(1);
+		fpos.setBeginIndex(5);
+		fpos.setEndIndex(110);
+		assertEquals("hashCode returned incorrect value", 620, fpos.hashCode());
+
+		FieldPosition fpos2 = new FieldPosition(
+				DateFormat.Field.DAY_OF_WEEK_IN_MONTH);
+		fpos2.setBeginIndex(5);
+		fpos2.setEndIndex(110);
+		assertEquals("hashCode returned incorrect value", 451685956, fpos2
+				.hashCode());
+	}
+
+	/**
+	 * @tests java.text.FieldPosition#setBeginIndex(int)
+	 */
+	public void test_setBeginIndexI() {
+		// Test for method void java.text.FieldPosition.setBeginIndex(int)
+		FieldPosition fpos = new FieldPosition(1);
+		fpos.setBeginIndex(2);
+		fpos.setEndIndex(3);
+		assertTrue("beginIndex should have been set to 2",
+				fpos.getBeginIndex() == 2);
+	}
+
+	/**
+	 * @tests java.text.FieldPosition#setEndIndex(int)
+	 */
+	public void test_setEndIndexI() {
+		// Test for method void java.text.FieldPosition.setEndIndex(int)
+		FieldPosition fpos = new FieldPosition(1);
+		fpos.setEndIndex(3);
+		fpos.setBeginIndex(2);
+		assertTrue("EndIndex should have been set to 3",
+				fpos.getEndIndex() == 3);
+	}
+
+	/**
+	 * @tests java.text.FieldPosition#toString()
+	 */
+	public void test_toString() {
+		// Test for method java.lang.String java.text.FieldPosition.toString()
+		FieldPosition fpos = new FieldPosition(1);
+		fpos.setBeginIndex(2);
+		fpos.setEndIndex(3);
+		assertEquals(
+				"ToString returned the wrong value:",
+				"java.text.FieldPosition[attribute=null, field=1, beginIndex=2, endIndex=3]",
+				fpos.toString());
+
+		FieldPosition fpos2 = new FieldPosition(DateFormat.Field.ERA);
+		fpos2.setBeginIndex(4);
+		fpos2.setEndIndex(5);
+		assertEquals("ToString returned the wrong value:",
+				"java.text.FieldPosition[attribute=" + DateFormat.Field.ERA
+						+ ", field=-1, beginIndex=4, endIndex=5]", fpos2
+						.toString());
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+	}
+
+	/**
+	 * Tears down the fixture, for example, close a network connection. This
+	 * method is called after a test is executed.
+	 */
+	protected void tearDown() {
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/MessageFormatFieldTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/MessageFormatFieldTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/MessageFormatFieldTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/MessageFormatFieldTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,44 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package tests.api.java.text;
+
+public class MessageFormatFieldTest extends junit.framework.TestCase {
+	/**
+	 * @tests java.text.MessageFormat$Field#Field(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// protected constructor
+	}
+
+	/**
+	 * @tests java.text.MessageFormat$Field#readResolve()
+	 */
+	public void test_readResolve() {
+		// test for method java.lang.Object readResolve()
+
+		// see serialization stress tests:
+		// implemented in
+		// SerializationStressTest4.test_writeObject_MessageFormat_Field()
+	}
+
+	protected void setUp() {
+	}
+
+	protected void tearDown() {
+	}
+
+	protected void doneSuite() {
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/MessageFormatTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/MessageFormatTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/MessageFormatTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/MessageFormatTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,704 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package tests.api.java.text;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.text.ChoiceFormat;
+import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.text.FieldPosition;
+import java.text.Format;
+import java.text.MessageFormat;
+import java.text.NumberFormat;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+
+import tests.support.Support_MessageFormat;
+
+public class MessageFormatTest extends junit.framework.TestCase {
+
+	private MessageFormat format1, format2, format3;
+
+	private void checkSerialization(MessageFormat format) {
+		try {
+			ByteArrayOutputStream ba = new ByteArrayOutputStream();
+			ObjectOutputStream out = new ObjectOutputStream(ba);
+			out.writeObject(format);
+			out.close();
+			ObjectInputStream in = new ObjectInputStream(
+					new ByteArrayInputStream(ba.toByteArray()));
+			MessageFormat read = (MessageFormat) in.readObject();
+			assertTrue("Not equal: " + format.toPattern(), format.equals(read));
+		} catch (IOException e) {
+			fail("Format: " + format.toPattern()
+					+ " caused IOException: " + e);
+		} catch (ClassNotFoundException e) {
+			fail("Format: " + format.toPattern()
+					+ " caused ClassNotFoundException: " + e);
+		}
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#MessageFormat(java.lang.String,
+	 *        java.util.Locale)
+	 */
+	public void test_ConstructorLjava_lang_StringLjava_util_Locale() {
+		// Test for method java.text.MessageFormat(java.lang.String,
+		// java.util.Locale)
+		Locale mk = new Locale("mk", "MK");
+		MessageFormat format = new MessageFormat(
+				"Date: {0,date} Currency: {1, number, currency} Integer: {2, number, integer}",
+				mk);
+
+		assertTrue("Wrong locale1", format.getLocale().equals(mk));
+		assertTrue("Wrong locale2", format.getFormats()[0].equals(DateFormat
+				.getDateInstance(DateFormat.DEFAULT, mk)));
+		assertTrue("Wrong locale3", format.getFormats()[1].equals(NumberFormat
+				.getCurrencyInstance(mk)));
+		assertTrue("Wrong locale4", format.getFormats()[2].equals(NumberFormat
+				.getIntegerInstance(mk)));
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#MessageFormat(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method java.text.MessageFormat(java.lang.String)
+		MessageFormat format = new MessageFormat(
+				"abc {4,time} def {3,date} ghi {2,number} jkl {1,choice,0#low|1#high} mnop {0}");
+		assertTrue("Not a MessageFormat",
+				format.getClass() == MessageFormat.class);
+		Format[] formats = format.getFormats();
+		assertTrue("null formats", formats != null);
+		assertTrue("Wrong format count: " + formats.length, formats.length >= 5);
+		assertTrue("Wrong time format", formats[0].equals(DateFormat
+				.getTimeInstance()));
+		assertTrue("Wrong date format", formats[1].equals(DateFormat
+				.getDateInstance()));
+		assertTrue("Wrong number format", formats[2].equals(NumberFormat
+				.getInstance()));
+		assertTrue("Wrong choice format", formats[3].equals(new ChoiceFormat(
+				"0.0#low|1.0#high")));
+		assertTrue("Wrong string format", formats[4] == null);
+
+		Date date = new Date();
+		FieldPosition pos = new FieldPosition(-1);
+		StringBuffer buffer = new StringBuffer();
+		format.format(new Object[] { "123", new Double(1.6), new Double(7.2),
+				date, date }, buffer, pos);
+		String result = buffer.toString();
+		buffer.setLength(0);
+		buffer.append("abc ");
+		buffer.append(DateFormat.getTimeInstance().format(date));
+		buffer.append(" def ");
+		buffer.append(DateFormat.getDateInstance().format(date));
+		buffer.append(" ghi ");
+		buffer.append(NumberFormat.getInstance().format(new Double(7.2)));
+		buffer.append(" jkl high mnop 123");
+		assertTrue("Wrong answer:\n" + result + "\n" + buffer, result
+				.equals(buffer.toString()));
+
+		assertTrue("Simple string", new MessageFormat("Test message").format(
+				new Object[0]).equals("Test message"));
+
+		try {
+			result = new MessageFormat("Don't").format(new Object[0]);
+			assertTrue("Should not throw IllegalArgumentException: " + result,
+					"Dont".equals(result));
+		} catch (Exception e) {
+			fail("Unexpected exception: " + e);
+		}
+
+		MessageFormat format2 = null;
+		try {
+			format2 = new MessageFormat("Invalid {1,foobar} format descriptor!");
+			fail("Expected test_ConstructorLjava_lang_String to throw IAE.");
+		} catch (IllegalArgumentException ex) {
+			// expected
+		} catch (Throwable ex) {
+			fail("Expected test_ConstructorLjava_lang_String to throw IAE, not a "
+					+ ex.getClass().getName());
+		}
+
+		try {
+			format2 = new MessageFormat(
+					"Invalid {1,date,invalid-spec} format descriptor!");
+		} catch (IllegalArgumentException ex) {
+			// expected
+		} catch (Throwable ex) {
+			fail("Expected test_ConstructorLjava_lang_String to throw IAE, not a "
+					+ ex.getClass().getName());
+		}
+
+		checkSerialization(new MessageFormat(""));
+		checkSerialization(new MessageFormat("noargs"));
+		checkSerialization(new MessageFormat("{0}"));
+		checkSerialization(new MessageFormat("a{0}"));
+		checkSerialization(new MessageFormat("{0}b"));
+		checkSerialization(new MessageFormat("a{0}b"));
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#applyPattern(java.lang.String)
+	 */
+	public void test_applyPatternLjava_lang_String() {
+		// Test for method void
+		// java.text.MessageFormat.applyPattern(java.lang.String)
+		MessageFormat format = new MessageFormat("test");
+		format.applyPattern("xx {0}");
+		assertTrue("Invalid number", format.format(
+				new Object[] { new Integer(46) }).equals("xx 46"));
+		Date date = new Date();
+		String result = format.format(new Object[] { date });
+		String expected = "xx " + DateFormat.getInstance().format(date);
+		assertTrue("Invalid date:\n" + result + "\n" + expected, result
+				.equals(expected));
+		format = new MessageFormat("{0,date}{1,time}{2,number,integer}");
+		format.applyPattern("nothing");
+		assertTrue("Found formats", format.toPattern().equals("nothing"));
+
+		format.applyPattern("{0}");
+		assertTrue("Wrong format", format.getFormats()[0] == null);
+		assertTrue("Wrong pattern", format.toPattern().equals("{0}"));
+
+		format.applyPattern("{0, \t\u001ftime }");
+		assertTrue("Wrong time format", format.getFormats()[0]
+				.equals(DateFormat.getTimeInstance()));
+		assertTrue("Wrong time pattern", format.toPattern().equals("{0,time}"));
+		format.applyPattern("{0,Time, Short\n}");
+		assertTrue("Wrong short time format", format.getFormats()[0]
+				.equals(DateFormat.getTimeInstance(DateFormat.SHORT)));
+		assertTrue("Wrong short time pattern", format.toPattern().equals(
+				"{0,time,short}"));
+		format.applyPattern("{0,TIME,\nmedium  }");
+		assertTrue("Wrong medium time format", format.getFormats()[0]
+				.equals(DateFormat.getTimeInstance(DateFormat.MEDIUM)));
+		assertTrue("Wrong medium time pattern", format.toPattern().equals(
+				"{0,time}"));
+		format.applyPattern("{0,time,LONG}");
+		assertTrue("Wrong long time format", format.getFormats()[0]
+				.equals(DateFormat.getTimeInstance(DateFormat.LONG)));
+		assertTrue("Wrong long time pattern", format.toPattern().equals(
+				"{0,time,long}"));
+		format.setLocale(Locale.FRENCH); // use French since English has the
+		// same LONG and FULL time patterns
+		format.applyPattern("{0,time, Full}");
+		assertTrue("Wrong full time format", format.getFormats()[0]
+				.equals(DateFormat.getTimeInstance(DateFormat.FULL,
+						Locale.FRENCH)));
+		assertTrue("Wrong full time pattern", format.toPattern().equals(
+				"{0,time,full}"));
+		format.setLocale(Locale.getDefault());
+
+		format.applyPattern("{0, date}");
+		assertTrue("Wrong date format", format.getFormats()[0]
+				.equals(DateFormat.getDateInstance()));
+		assertTrue("Wrong date pattern", format.toPattern().equals("{0,date}"));
+		format.applyPattern("{0, date, short}");
+		assertTrue("Wrong short date format", format.getFormats()[0]
+				.equals(DateFormat.getDateInstance(DateFormat.SHORT)));
+		assertTrue("Wrong short date pattern", format.toPattern().equals(
+				"{0,date,short}"));
+		format.applyPattern("{0, date, medium}");
+		assertTrue("Wrong medium date format", format.getFormats()[0]
+				.equals(DateFormat.getDateInstance(DateFormat.MEDIUM)));
+		assertTrue("Wrong medium date pattern", format.toPattern().equals(
+				"{0,date}"));
+		format.applyPattern("{0, date, long}");
+		assertTrue("Wrong long date format", format.getFormats()[0]
+				.equals(DateFormat.getDateInstance(DateFormat.LONG)));
+		assertTrue("Wrong long date pattern", format.toPattern().equals(
+				"{0,date,long}"));
+		format.applyPattern("{0, date, full}");
+		assertTrue("Wrong full date format", format.getFormats()[0]
+				.equals(DateFormat.getDateInstance(DateFormat.FULL)));
+		assertTrue("Wrong full date pattern", format.toPattern().equals(
+				"{0,date,full}"));
+
+		format.applyPattern("{0, date, MMM d {hh:mm:ss}}");
+		assertTrue("Wrong time/date format", ((SimpleDateFormat) (format
+				.getFormats()[0])).toPattern().equals(" MMM d {hh:mm:ss}"));
+		assertTrue("Wrong time/date pattern", format.toPattern().equals(
+				"{0,date, MMM d {hh:mm:ss}}"));
+
+		format.applyPattern("{0, number}");
+		assertTrue("Wrong number format", format.getFormats()[0]
+				.equals(NumberFormat.getNumberInstance()));
+		assertTrue("Wrong number pattern", format.toPattern().equals(
+				"{0,number}"));
+		format.applyPattern("{0, number, currency}");
+		assertTrue("Wrong currency number format", format.getFormats()[0]
+				.equals(NumberFormat.getCurrencyInstance()));
+		assertTrue("Wrong currency number pattern", format.toPattern().equals(
+				"{0,number,currency}"));
+		format.applyPattern("{0, number, percent}");
+		assertTrue("Wrong percent number format", format.getFormats()[0]
+				.equals(NumberFormat.getPercentInstance()));
+		assertTrue("Wrong percent number pattern", format.toPattern().equals(
+				"{0,number,percent}"));
+		format.applyPattern("{0, number, integer}");
+		NumberFormat nf = NumberFormat.getInstance();
+		nf.setMaximumFractionDigits(0);
+		nf.setParseIntegerOnly(true);
+		assertTrue("Wrong integer number format", format.getFormats()[0]
+				.equals(nf));
+		assertTrue("Wrong integer number pattern", format.toPattern().equals(
+				"{0,number,integer}"));
+
+		format.applyPattern("{0, number, {'#'}##0.0E0}");
+		assertTrue("Wrong pattern number format", ((DecimalFormat) (format
+				.getFormats()[0])).toPattern().equals("' {#}'##0.0E0"));
+		assertTrue("Wrong pattern number pattern", format.toPattern().equals(
+				"{0,number,' {#}'##0.0E0}"));
+
+		format.applyPattern("{0, choice,0#no|1#one|2#{1,number}}");
+		assertTrue("Wrong choice format",
+				((ChoiceFormat) format.getFormats()[0]).toPattern().equals(
+						"0.0#no|1.0#one|2.0#{1,number}"));
+		assertTrue("Wrong choice pattern", format.toPattern().equals(
+				"{0,choice,0.0#no|1.0#one|2.0#{1,number}}"));
+		assertTrue("Wrong formatted choice", format.format(
+				new Object[] { new Integer(2), new Float(3.6) }).equals("3.6"));
+
+		try {
+			format.applyPattern("WRONG MESSAGE FORMAT {0,number,{}");
+			fail("Expected IllegalArgumentException for invalid pattern");
+		} catch (IllegalArgumentException e) {
+		}
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#clone()
+	 */
+	public void test_clone() {
+		// Test for method java.lang.Object java.text.MessageFormat.clone()
+		MessageFormat format = new MessageFormat("'{'choice'}'{0}");
+		MessageFormat clone = (MessageFormat) format.clone();
+		assertTrue("Clone not equal", format.equals(clone));
+		assertTrue("Wrong answer", format.format(new Object[] {}).equals(
+				"{choice}{0}"));
+		clone.setFormat(0, DateFormat.getInstance());
+		assertTrue("Clone shares format data", !format.equals(clone));
+		format = (MessageFormat) clone.clone();
+		Format[] formats = clone.getFormats();
+		((SimpleDateFormat) formats[0]).applyPattern("adk123");
+		assertTrue("Clone shares format data", !format.equals(clone));
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#equals(java.lang.Object)
+	 */
+	public void test_equalsLjava_lang_Object() {
+		// Test for method boolean
+		// java.text.MessageFormat.equals(java.lang.Object)
+		MessageFormat format1 = new MessageFormat("{0}");
+		MessageFormat format2 = new MessageFormat("{1}");
+		assertTrue("Should not be equal", !format1.equals(format2));
+		format2.applyPattern("{0}");
+		assertTrue("Should be equal", format1.equals(format2));
+		SimpleDateFormat date = (SimpleDateFormat) DateFormat.getTimeInstance();
+		format1.setFormat(0, DateFormat.getTimeInstance());
+		format2.setFormat(0, new SimpleDateFormat(date.toPattern()));
+		assertTrue("Should be equal2", format1.equals(format2));
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#formatToCharacterIterator(java.lang.Object)
+	 */
+	public void test_formatToCharacterIteratorLjava_lang_Object() {
+		// Test for method formatToCharacterIterator(java.lang.Object)
+		new Support_MessageFormat(
+				"test_formatToCharacterIteratorLjava_lang_Object")
+				.t_formatToCharacterIterator();
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#format(java.lang.Object[],
+	 *        java.lang.StringBuffer, java.text.FieldPosition)
+	 */
+	public void test_format$Ljava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition() {
+		// Test for method java.lang.StringBuffer
+		// java.text.MessageFormat.format(java.lang.Object [],
+		// java.lang.StringBuffer, java.text.FieldPosition)
+		MessageFormat format = new MessageFormat("{1,number,integer}");
+		StringBuffer buffer = new StringBuffer();
+		format.format(new Object[] { "0", new Double(53.863) }, buffer,
+				new FieldPosition(0));
+		assertTrue("Wrong result", buffer.toString().equals("54"));
+		format
+				.applyPattern("{0,choice,0#zero|1#one '{1,choice,2#two {2,time}}'}");
+		Date date = new Date();
+		String expected = "one two "
+				+ DateFormat.getTimeInstance().format(date);
+		String result = format.format(new Object[] { new Double(1.6),
+				new Integer(3), date });
+		assertTrue("Choice not recursive:\n" + expected + "\n" + result,
+				expected.equals(result));
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#format(java.lang.Object,
+	 *        java.lang.StringBuffer, java.text.FieldPosition)
+	 */
+	public void test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition() {
+		// Test for method java.lang.StringBuffer
+		// java.text.MessageFormat.format(java.lang.Object,
+		// java.lang.StringBuffer, java.text.FieldPosition)
+		new Support_MessageFormat(
+				"test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition")
+				.t_format_with_FieldPosition();
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#getFormats()
+	 */
+	public void test_getFormats() {
+		// Test for method java.text.Format []
+		// java.text.MessageFormat.getFormats()
+
+		// test with repeating formats and max argument index < max offset
+		Format[] formats = format1.getFormats();
+		Format[] correctFormats = new Format[] {
+				NumberFormat.getCurrencyInstance(),
+				DateFormat.getTimeInstance(),
+				NumberFormat.getPercentInstance(), null,
+				new ChoiceFormat("0#off|1#on"), DateFormat.getDateInstance(), };
+
+		assertEquals("Test1:Returned wrong number of formats:",
+				correctFormats.length, formats.length);
+		for (int i = 0; i < correctFormats.length; i++) {
+			assertEquals("Test1:wrong format for pattern index " + i + ":",
+					correctFormats[i], formats[i]);
+		}
+
+		// test with max argument index > max offset
+		formats = format2.getFormats();
+		correctFormats = new Format[] { NumberFormat.getCurrencyInstance(),
+				DateFormat.getTimeInstance(),
+				NumberFormat.getPercentInstance(), null,
+				new ChoiceFormat("0#off|1#on"), DateFormat.getDateInstance() };
+
+		assertEquals("Test2:Returned wrong number of formats:",
+				correctFormats.length, formats.length);
+		for (int i = 0; i < correctFormats.length; i++) {
+			assertEquals("Test2:wrong format for pattern index " + i + ":",
+					correctFormats[i], formats[i]);
+		}
+
+		// test with argument number being zero
+		formats = format3.getFormats();
+		assertEquals("Test3: Returned wrong number of formats:", 0,
+				formats.length);
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#getFormatsByArgumentIndex()
+	 */
+	public void test_getFormatsByArgumentIndex() {
+		// Test for method java.text.Format [] test_getFormatsByArgumentIndex()
+
+		// test with repeating formats and max argument index < max offset
+		Format[] formats = format1.getFormatsByArgumentIndex();
+		Format[] correctFormats = new Format[] { DateFormat.getDateInstance(),
+				new ChoiceFormat("0#off|1#on"), DateFormat.getTimeInstance(),
+				NumberFormat.getCurrencyInstance(), null };
+
+		assertEquals("Test1:Returned wrong number of formats:",
+				correctFormats.length, formats.length);
+		for (int i = 0; i < correctFormats.length; i++) {
+			assertEquals("Test1:wrong format for argument index " + i + ":",
+					correctFormats[i], formats[i]);
+		}
+
+		// test with max argument index > max offset
+		formats = format2.getFormatsByArgumentIndex();
+		correctFormats = new Format[] { DateFormat.getDateInstance(),
+				new ChoiceFormat("0#off|1#on"), null,
+				NumberFormat.getCurrencyInstance(), null, null, null, null,
+				DateFormat.getTimeInstance() };
+
+		assertEquals("Test2:Returned wrong number of formats:",
+				correctFormats.length, formats.length);
+		for (int i = 0; i < correctFormats.length; i++) {
+			assertEquals("Test2:wrong format for argument index " + i + ":",
+					correctFormats[i], formats[i]);
+		}
+
+		// test with argument number being zero
+		formats = format3.getFormatsByArgumentIndex();
+		assertEquals("Test3: Returned wrong number of formats:", 0,
+				formats.length);
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#setFormatByArgumentIndex(int,
+	 *        java.text.Format)
+	 */
+	public void test_setFormatByArgumentIndexILjava_text_Format() {
+		// test for method setFormatByArgumentIndex(int, Format)
+		MessageFormat f1 = (MessageFormat) format1.clone();
+		f1.setFormatByArgumentIndex(0, DateFormat.getTimeInstance());
+		f1.setFormatByArgumentIndex(4, new ChoiceFormat("1#few|2#ok|3#a lot"));
+
+		// test with repeating formats and max argument index < max offset
+		// compare getFormatsByArgumentIndex() results after calls to
+		// setFormatByArgumentIndex()
+		Format[] formats = f1.getFormatsByArgumentIndex();
+
+		Format[] correctFormats = new Format[] { DateFormat.getTimeInstance(),
+				new ChoiceFormat("0#off|1#on"), DateFormat.getTimeInstance(),
+				NumberFormat.getCurrencyInstance(),
+				new ChoiceFormat("1#few|2#ok|3#a lot") };
+
+		assertEquals("Test1A:Returned wrong number of formats:",
+				correctFormats.length, formats.length);
+		for (int i = 0; i < correctFormats.length; i++) {
+			assertEquals("Test1B:wrong format for argument index " + i + ":",
+					correctFormats[i], formats[i]);
+		}
+
+		// compare getFormats() results after calls to
+		// setFormatByArgumentIndex()
+		formats = f1.getFormats();
+
+		correctFormats = new Format[] { NumberFormat.getCurrencyInstance(),
+				DateFormat.getTimeInstance(), DateFormat.getTimeInstance(),
+				new ChoiceFormat("1#few|2#ok|3#a lot"),
+				new ChoiceFormat("0#off|1#on"), DateFormat.getTimeInstance(), };
+
+		assertEquals("Test1C:Returned wrong number of formats:",
+				correctFormats.length, formats.length);
+		for (int i = 0; i < correctFormats.length; i++) {
+			assertEquals("Test1D:wrong format for pattern index " + i + ":",
+					correctFormats[i], formats[i]);
+		}
+
+		// test setting argumentIndexes that are not used
+		MessageFormat f2 = (MessageFormat) format2.clone();
+		f2.setFormatByArgumentIndex(2, NumberFormat.getPercentInstance());
+		f2.setFormatByArgumentIndex(4, DateFormat.getTimeInstance());
+
+		formats = f2.getFormatsByArgumentIndex();
+		correctFormats = format2.getFormatsByArgumentIndex();
+
+		assertEquals("Test2A:Returned wrong number of formats:",
+				correctFormats.length, formats.length);
+		for (int i = 0; i < correctFormats.length; i++) {
+			assertEquals("Test2B:wrong format for argument index " + i + ":",
+					correctFormats[i], formats[i]);
+		}
+
+		formats = f2.getFormats();
+		correctFormats = format2.getFormats();
+
+		assertEquals("Test2C:Returned wrong number of formats:",
+				correctFormats.length, formats.length);
+		for (int i = 0; i < correctFormats.length; i++) {
+			assertEquals("Test2D:wrong format for pattern index " + i + ":",
+					correctFormats[i], formats[i]);
+		}
+
+		// test exceeding the argumentIndex number
+		MessageFormat f3 = (MessageFormat) format3.clone();
+		f3.setFormatByArgumentIndex(1, NumberFormat.getCurrencyInstance());
+
+		formats = f3.getFormatsByArgumentIndex();
+		assertEquals("Test3A:Returned wrong number of formats:", 0,
+				formats.length);
+
+		formats = f3.getFormats();
+		assertEquals("Test3B:Returned wrong number of formats:", 0,
+				formats.length);
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#setFormatsByArgumentIndex(java.text.Format[])
+	 */
+	public void test_setFormatsByArgumentIndex$Ljava_text_Format() {
+		// test for method setFormatByArgumentIndex(Format[])
+		MessageFormat f1 = (MessageFormat) format1.clone();
+
+		// test with repeating formats and max argument index < max offset
+		// compare getFormatsByArgumentIndex() results after calls to
+		// setFormatsByArgumentIndex(Format[])
+		Format[] correctFormats = new Format[] { DateFormat.getTimeInstance(),
+				new ChoiceFormat("0#off|1#on"), DateFormat.getTimeInstance(),
+				NumberFormat.getCurrencyInstance(),
+				new ChoiceFormat("1#few|2#ok|3#a lot") };
+
+		f1.setFormatsByArgumentIndex(correctFormats);
+		Format[] formats = f1.getFormatsByArgumentIndex();
+
+		assertEquals("Test1A:Returned wrong number of formats:",
+				correctFormats.length, formats.length);
+		for (int i = 0; i < correctFormats.length; i++) {
+			assertEquals("Test1B:wrong format for argument index " + i + ":",
+					correctFormats[i], formats[i]);
+		}
+
+		// compare getFormats() results after calls to
+		// setFormatByArgumentIndex()
+		formats = f1.getFormats();
+		correctFormats = new Format[] { NumberFormat.getCurrencyInstance(),
+				DateFormat.getTimeInstance(), DateFormat.getTimeInstance(),
+				new ChoiceFormat("1#few|2#ok|3#a lot"),
+				new ChoiceFormat("0#off|1#on"), DateFormat.getTimeInstance(), };
+
+		assertEquals("Test1C:Returned wrong number of formats:",
+				correctFormats.length, formats.length);
+		for (int i = 0; i < correctFormats.length; i++) {
+			assertEquals("Test1D:wrong format for pattern index " + i + ":",
+					correctFormats[i], formats[i]);
+		}
+
+		// test setting argumentIndexes that are not used
+		MessageFormat f2 = (MessageFormat) format2.clone();
+		Format[] inputFormats = new Format[] { DateFormat.getDateInstance(),
+				new ChoiceFormat("0#off|1#on"),
+				NumberFormat.getPercentInstance(),
+				NumberFormat.getCurrencyInstance(),
+				DateFormat.getTimeInstance(), null, null, null,
+				DateFormat.getTimeInstance() };
+		f2.setFormatsByArgumentIndex(inputFormats);
+
+		formats = f2.getFormatsByArgumentIndex();
+		correctFormats = format2.getFormatsByArgumentIndex();
+
+		assertEquals("Test2A:Returned wrong number of formats:",
+				correctFormats.length, formats.length);
+		for (int i = 0; i < correctFormats.length; i++) {
+			assertEquals("Test2B:wrong format for argument index " + i + ":",
+					correctFormats[i], formats[i]);
+		}
+
+		formats = f2.getFormats();
+		correctFormats = new Format[] { NumberFormat.getCurrencyInstance(),
+				DateFormat.getTimeInstance(), DateFormat.getDateInstance(),
+				null, new ChoiceFormat("0#off|1#on"),
+				DateFormat.getDateInstance() };
+
+		assertEquals("Test2C:Returned wrong number of formats:",
+				correctFormats.length, formats.length);
+		for (int i = 0; i < correctFormats.length; i++) {
+			assertEquals("Test2D:wrong format for pattern index " + i + ":",
+					correctFormats[i], formats[i]);
+		}
+
+		// test exceeding the argumentIndex number
+		MessageFormat f3 = (MessageFormat) format3.clone();
+		f3.setFormatsByArgumentIndex(inputFormats);
+
+		formats = f3.getFormatsByArgumentIndex();
+		assertEquals("Test3A:Returned wrong number of formats:", 0,
+				formats.length);
+
+		formats = f3.getFormats();
+		assertEquals("Test3B:Returned wrong number of formats:", 0,
+				formats.length);
+
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#parse(java.lang.String,
+	 *        java.text.ParsePosition)
+	 */
+	public void test_parseLjava_lang_StringLjava_text_ParsePosition() {
+		// Test for method java.lang.Object []
+		// java.text.MessageFormat.parse(java.lang.String,
+		// java.text.ParsePosition)
+		MessageFormat format = new MessageFormat("date is {0,date,MMM d, yyyy}");
+		ParsePosition pos = new ParsePosition(2);
+		Object[] result = (Object[]) format
+				.parse("xxdate is Feb 28, 1999", pos);
+		assertTrue("No result: " + result.length, result.length >= 1);
+		assertTrue("Wrong answer", ((Date) result[0])
+				.equals(new GregorianCalendar(1999, Calendar.FEBRUARY, 28)
+						.getTime()));
+
+		MessageFormat mf = new MessageFormat("vm={0},{1},{2}");
+		result = mf.parse("vm=win,foo,bar", new ParsePosition(0));
+		assertTrue("Invalid parse", result[0].equals("win")
+				&& result[1].equals("foo") && result[2].equals("bar"));
+
+		mf = new MessageFormat("{0}; {0}; {0}");
+		String parse = "a; b; c";
+		result = mf.parse(parse, new ParsePosition(0));
+		assertTrue("Wrong variable result", result[0].equals("c"));
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#setLocale(java.util.Locale)
+	 */
+	public void test_setLocaleLjava_util_Locale() {
+		// Test for method void
+		// java.text.MessageFormat.setLocale(java.util.Locale)
+		MessageFormat format = new MessageFormat("date {0,date}");
+		String pattern = ((SimpleDateFormat) format.getFormats()[0])
+				.toPattern();
+		format.setLocale(Locale.CHINA);
+		assertTrue("Wrong locale1", format.getLocale().equals(Locale.CHINA));
+		assertTrue("Wrong locale2", format.getFormats()[0]
+				.equals(new SimpleDateFormat(pattern, Locale.CHINA)));
+		format.applyPattern("{1,date}");
+		assertTrue("Wrong locale3", format.getFormats()[0].equals(DateFormat
+				.getDateInstance(DateFormat.DEFAULT, Locale.CHINA)));
+	}
+
+	/**
+	 * @tests java.text.MessageFormat#toPattern()
+	 */
+	public void test_toPattern() {
+		// Test for method java.lang.String java.text.MessageFormat.toPattern()
+		String pattern = "[{0}]";
+		MessageFormat mf = new MessageFormat(pattern);
+		assertTrue("Wrong pattern", mf.toPattern().equals(pattern));
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+		// test with repeating formats and max argument index < max offset
+		String pattern = "A {3, number, currency} B {2, time} C {0, number, percent} D {4}  E {1,choice,0#off|1#on} F {0, date}";
+		format1 = new MessageFormat(pattern);
+
+		// test with max argument index > max offset
+		pattern = "A {3, number, currency} B {8, time} C {0, number, percent} D {6}  E {1,choice,0#off|1#on} F {0, date}";
+		format2 = new MessageFormat(pattern);
+
+		// test with argument number being zero
+		pattern = "A B C D E F";
+		format3 = new MessageFormat(pattern);
+	}
+
+	/**
+	 * Tears down the fixture, for example, close a network connection. This
+	 * method is called after a test is executed.
+	 */
+	protected void tearDown() {
+	}
+
+	protected void doneSuite() {
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/NumberFormatFieldTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/NumberFormatFieldTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/NumberFormatFieldTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/tests/api/java/text/NumberFormatFieldTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,44 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package tests.api.java.text;
+
+public class NumberFormatFieldTest extends junit.framework.TestCase {
+	/**
+	 * @tests java.text.NumberFormat$Field#Field(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// protected constructor
+	}
+
+	/**
+	 * @tests java.text.NumberFormat$Field#readResolve()
+	 */
+	public void test_readResolve() {
+		// test for method java.lang.Object readResolve()
+
+		// see serialization stress tests:
+		// implemented in
+		// SerializationStressTest4.test_writeObject_NumberFormat_Field()
+	}
+
+	protected void setUp() {
+	}
+
+	protected void tearDown() {
+	}
+
+	protected void doneSuite() {
+	}
+}



Mime
View raw message