Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 91532 invoked from network); 26 Apr 2006 09:47:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Apr 2006 09:47:10 -0000 Received: (qmail 30272 invoked by uid 500); 26 Apr 2006 09:47:09 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 30236 invoked by uid 500); 26 Apr 2006 09:47:09 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 30225 invoked by uid 99); 26 Apr 2006 09:47:09 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Apr 2006 02:47:09 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 26 Apr 2006 02:47:06 -0700 Received: (qmail 91330 invoked by uid 65534); 26 Apr 2006 09:46:45 -0000 Message-ID: <20060426094645.91329.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r397158 - /incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ Date: Wed, 26 Apr 2006 09:46:23 -0000 To: harmony-commits@incubator.apache.org From: smishura@apache.org X-Mailer: svnmailer-1.0.8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: smishura Date: Wed Apr 26 02:46:17 2006 New Revision: 397158 URL: http://svn.apache.org/viewcvs?rev=397158&view=rev Log: Apply patch for HARMONY-353 (improvements to junit test method usage) for text module. All text tests passed on Windows. Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/AnnotationTest.java incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/AttributedCharacterIteratorTest.java incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ChoiceFormatTest.java incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/CollationKeyTest.java incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/CollatorTest.java incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/FieldPositionTest.java incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/NumberFormatTest.java incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParseExceptionTest.java incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParsePositionTest.java incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/StringCharacterIteratorTest.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/AnnotationTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/AnnotationTest.java?rev=397158&r1=397157&r2=397158&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/AnnotationTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/AnnotationTest.java Wed Apr 26 02:46:17 2006 @@ -44,9 +44,9 @@ */ public void testToString() { Annotation ant = new Annotation("HelloWorld"); - assertTrue("toString error.", ant.toString().equals( - "java.text.Annotation[value=HelloWorld]")); - assertNotNull(new Annotation(null).toString()); - assertNotNull(new Annotation("value").toString()); + assertEquals("toString error.", + "java.text.Annotation[value=HelloWorld]",ant.toString()); + assertNotNull(new Annotation(null).toString()); + assertNotNull(new Annotation("value").toString()); } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/AttributedCharacterIteratorTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/AttributedCharacterIteratorTest.java?rev=397158&r1=397157&r2=397158&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/AttributedCharacterIteratorTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/AttributedCharacterIteratorTest.java Wed Apr 26 02:46:17 2006 @@ -28,17 +28,17 @@ String test = "Test 23ring"; AttributedString attrString = new AttributedString(test); AttributedCharacterIterator it = attrString.getIterator(); - assertTrue("Wrong first", it.current() == 'T'); + assertEquals("Wrong first", 'T', it.current()); it.next(); - assertTrue("Wrong second", it.current() == 'e'); + assertEquals("Wrong second", 'e', it.current()); for (int i = 0; i < 9; i++) it.next(); - assertTrue("Wrong last", it.current() == 'g'); + assertEquals("Wrong last", 'g', it.current()); it.next(); assertTrue("Wrong final", it.current() == CharacterIterator.DONE); it = attrString.getIterator(null, 2, 8); - assertTrue("Wrong first2", it.current() == 's'); + assertEquals("Wrong first2", 's', it.current()); } /** @@ -48,11 +48,11 @@ String test = "Test 23ring"; AttributedString attrString = new AttributedString(test); AttributedCharacterIterator it = attrString.getIterator(); - assertTrue("Wrong first1", it.first() == 'T'); + assertEquals("Wrong first1", 'T', it.first()); it = attrString.getIterator(null, 0, 3); - assertTrue("Wrong first2", it.first() == 'T'); + assertEquals("Wrong first2", 'T', it.first()); it = attrString.getIterator(null, 2, 8); - assertTrue("Wrong first3", it.first() == 's'); + assertEquals("Wrong first3", 's', it.first()); it = attrString.getIterator(null, 11, 11); assertTrue("Wrong first4", it.first() == CharacterIterator.DONE); } @@ -64,7 +64,7 @@ String test = "Test 23ring"; AttributedString attrString = new AttributedString(test); AttributedCharacterIterator it = attrString.getIterator(null, 2, 6); - assertTrue("Wrong begin index", it.getBeginIndex() == 2); + assertEquals("Wrong begin index", 2, it.getBeginIndex()); } /** @@ -74,7 +74,7 @@ String test = "Test 23ring"; AttributedString attrString = new AttributedString(test); AttributedCharacterIterator it = attrString.getIterator(null, 2, 6); - assertTrue("Wrong begin index", it.getEndIndex() == 6); + assertEquals("Wrong begin index", 6, it.getEndIndex()); } /** @@ -84,14 +84,14 @@ String test = "Test 23ring"; AttributedString attrString = new AttributedString(test); AttributedCharacterIterator it = attrString.getIterator(); - assertTrue("Wrong first", it.getIndex() == 0); + assertEquals("Wrong first", 0, it.getIndex()); it.next(); - assertTrue("Wrong second", it.getIndex() == 1); + assertEquals("Wrong second", 1, it.getIndex()); for (int i = 0; i < 9; i++) it.next(); - assertTrue("Wrong last", it.getIndex() == 10); + assertEquals("Wrong last", 10, it.getIndex()); it.next(); - assertTrue("Wrong final", it.getIndex() == 11); + assertEquals("Wrong final", 11, it.getIndex()); } /** @@ -101,11 +101,11 @@ String test = "Test 23ring"; AttributedString attrString = new AttributedString(test); AttributedCharacterIterator it = attrString.getIterator(); - assertTrue("Wrong last1", it.last() == 'g'); + assertEquals("Wrong last1", 'g', it.last()); it = attrString.getIterator(null, 0, 3); - assertTrue("Wrong last2", it.last() == 's'); + assertEquals("Wrong last2", 's', it.last()); it = attrString.getIterator(null, 2, 8); - assertTrue("Wrong last3", it.last() == 'r'); + assertEquals("Wrong last3", 'r', it.last()); it = attrString.getIterator(null, 0, 0); assertTrue("Wrong last4", it.last() == CharacterIterator.DONE); } @@ -117,14 +117,14 @@ String test = "Test 23ring"; AttributedString attrString = new AttributedString(test); AttributedCharacterIterator it = attrString.getIterator(); - assertTrue("Wrong first", it.next() == 'e'); + assertEquals("Wrong first", 'e', it.next()); for (int i = 0; i < 8; i++) it.next(); - assertTrue("Wrong last", it.next() == 'g'); + assertEquals("Wrong last", 'g', it.next()); assertTrue("Wrong final", it.next() == CharacterIterator.DONE); it = attrString.getIterator(null, 2, 8); - assertTrue("Wrong first2", it.next() == 't'); + assertEquals("Wrong first2", 't', it.next()); } /** @@ -135,7 +135,7 @@ AttributedString attrString = new AttributedString(test); AttributedCharacterIterator it = attrString.getIterator(); it.setIndex(11); - assertTrue("Wrong first", it.previous() == 'g'); + assertEquals("Wrong first", 'g', it.previous()); } /** @@ -146,7 +146,7 @@ AttributedString attrString = new AttributedString(test); AttributedCharacterIterator it = attrString.getIterator(); it.setIndex(5); - assertTrue("Wrong first", it.current() == '2'); + assertEquals("Wrong first", '2', it.current()); } /** @@ -157,17 +157,15 @@ as.addAttribute(AttributedCharacterIterator.Attribute.LANGUAGE, "a", 2, 3); AttributedCharacterIterator it = as.getIterator(); - assertTrue( - "non-null value limit", - it.getRunLimit(AttributedCharacterIterator.Attribute.LANGUAGE) == 2); + assertEquals("non-null value limit", + 2, it.getRunLimit(AttributedCharacterIterator.Attribute.LANGUAGE)); as = new AttributedString("test"); as.addAttribute(AttributedCharacterIterator.Attribute.LANGUAGE, null, 2, 3); it = as.getIterator(); - assertTrue( - "null value limit", - it.getRunLimit(AttributedCharacterIterator.Attribute.LANGUAGE) == 4); + assertEquals("null value limit", + 4, it.getRunLimit(AttributedCharacterIterator.Attribute.LANGUAGE)); } protected void setUp() { Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ChoiceFormatTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ChoiceFormatTest.java?rev=397158&r1=397157&r2=397158&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ChoiceFormatTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ChoiceFormatTest.java Wed Apr 26 02:46:17 2006 @@ -205,19 +205,19 @@ FieldPosition field = new FieldPosition(0); StringBuffer buf = new StringBuffer(); String r = f1.format(-1, buf, field).toString(); - assertTrue("Wrong choice for -1", r.equals("Less than one")); + assertEquals("Wrong choice for -1", "Less than one", r); buf.setLength(0); r = f1.format(0, buf, field).toString(); - assertTrue("Wrong choice for 0", r.equals("Less than one")); + assertEquals("Wrong choice for 0", "Less than one", r); buf.setLength(0); r = f1.format(1, buf, field).toString(); - assertTrue("Wrong choice for 1", r.equals("one")); + assertEquals("Wrong choice for 1", "one", r); buf.setLength(0); r = f1.format(2, buf, field).toString(); - assertTrue("Wrong choice for 2", r.equals("Between one and two")); + assertEquals("Wrong choice for 2", "Between one and two", r); buf.setLength(0); r = f1.format(3, buf, field).toString(); - assertTrue("Wrong choice for 3", r.equals("Greater than two")); + assertEquals("Wrong choice for 3", "Greater than two", r); } /** @@ -231,13 +231,13 @@ FieldPosition field = new FieldPosition(0); StringBuffer buf = new StringBuffer(); String r = f1.format(0.5, buf, field).toString(); - assertTrue("Wrong choice for 0.5", r.equals("Less than one")); + assertEquals("Wrong choice for 0.5", "Less than one", r); buf.setLength(0); r = f1.format(1.5, buf, field).toString(); - assertTrue("Wrong choice for 1.5", r.equals("Between one and two")); + assertEquals("Wrong choice for 1.5", "Between one and two", r); buf.setLength(0); r = f1.format(2.5, buf, field).toString(); - assertTrue("Wrong choice for 2.5", r.equals("Greater than two")); + assertEquals("Wrong choice for 2.5", "Greater than two", r); } /** @@ -305,24 +305,24 @@ // java.text.ChoiceFormat.parse(java.lang.String, // java.text.ParsePosition) ChoiceFormat format = new ChoiceFormat("1#one|2#two|3#three"); - assertTrue("Case insensitive", format - .parse("One", new ParsePosition(0)).intValue() == 0); + assertEquals("Case insensitive", 0, format + .parse("One", new ParsePosition(0)).intValue()); ParsePosition pos = new ParsePosition(0); Number result = f1.parse("Greater than two", pos); assertTrue("Not a Double1", result instanceof Double); assertTrue("Wrong value ~>2", result.doubleValue() == ChoiceFormat .nextDouble(2)); - assertTrue("Wrong position ~16", pos.getIndex() == 16); + assertEquals("Wrong position ~16", 16, pos.getIndex()); pos = new ParsePosition(0); assertTrue("Incorrect result", Double.isNaN(f1.parse("12one", pos) .doubleValue())); - assertTrue("Wrong position ~0", pos.getIndex() == 0); + assertEquals("Wrong position ~0", 0, pos.getIndex()); pos = new ParsePosition(2); result = f1.parse("12one and two", pos); assertTrue("Not a Double2", result instanceof Double); - assertTrue("Ignored parse position", result.doubleValue() == 1.0); - assertTrue("Wrong position ~5", pos.getIndex() == 5); + assertEquals("Ignored parse position", 1.0, result.doubleValue()); + assertEquals("Wrong position ~5", 5, pos.getIndex()); } /** @@ -379,8 +379,8 @@ MessageFormat mf = new MessageFormat("CHOICE {1,choice}"); String ptrn = mf.toPattern(); - assertTrue("Unused message format returning incorrect pattern", ptrn - .equals("CHOICE {1,choice,}")); + assertEquals("Unused message format returning incorrect pattern", "CHOICE {1,choice,}", ptrn + ); String pattern = f1.toPattern(); assertTrue( @@ -393,8 +393,8 @@ String str = "org.apache.harmony.tests.java.lang.share.MyResources2"; cf.applyPattern(str); ptrn = cf.toPattern(); - assertTrue("Return value should be empty string for invalid pattern", - ptrn.length() == 0); + assertEquals("Return value should be empty string for invalid pattern", + 0, ptrn.length()); } /** Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/CollationKeyTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/CollationKeyTest.java?rev=397158&r1=397157&r2=397158&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/CollationKeyTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/CollationKeyTest.java Wed Apr 26 02:46:17 2006 @@ -30,7 +30,7 @@ collator.setStrength(Collator.PRIMARY); CollationKey key1 = collator.getCollationKey("abc"); CollationKey key2 = collator.getCollationKey("ABC"); - assertTrue("Should be equal", key1.compareTo(key2) == 0); + assertEquals("Should be equal", 0, key1.compareTo(key2)); } /** @@ -43,7 +43,7 @@ collator.setStrength(Collator.PRIMARY); CollationKey key1 = collator.getCollationKey("abc"); CollationKey key2 = collator.getCollationKey("ABC"); - assertTrue("Should be equal", key1.compareTo(key2) == 0); + assertEquals("Should be equal", 0, key1.compareTo(key2)); } /** Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/CollatorTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/CollatorTest.java?rev=397158&r1=397157&r2=397158&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/CollatorTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/CollatorTest.java Wed Apr 26 02:46:17 2006 @@ -53,7 +53,7 @@ assertTrue("a) Failed on identical", c.compare(o, o2) < 0); o = "e"; o2 = "e"; - assertTrue("a) Failed on equivalence", c.compare(o, o2) == 0); + assertEquals("a) Failed on equivalence", 0, c.compare(o, o2)); assertTrue("a) Failed on primary expansion", c.compare("\u01db", "v") < 0); @@ -69,10 +69,10 @@ assertTrue("b) Failed on tertiary difference", c.compare(o, o2) < 0); o = "\u0001"; o2 = "\u0002"; - assertTrue("b) Failed on identical", c.compare(o, o2) == 0); + assertEquals("b) Failed on identical", 0, c.compare(o, o2)); o = "e"; o2 = "e"; - assertTrue("b) Failed on equivalence", c.compare(o, o2) == 0); + assertEquals("b) Failed on equivalence", 0, c.compare(o, o2)); c.setStrength(Collator.SECONDARY); o = "E"; @@ -83,13 +83,13 @@ assertTrue("c) Failed on secondary difference", c.compare(o, o2) < 0); o = "e"; o2 = "E"; - assertTrue("c) Failed on tertiary difference", c.compare(o, o2) == 0); + assertEquals("c) Failed on tertiary difference", 0, c.compare(o, o2)); o = "\u0001"; o2 = "\u0002"; - assertTrue("c) Failed on identical", c.compare(o, o2) == 0); + assertEquals("c) Failed on identical", 0, c.compare(o, o2)); o = "e"; o2 = "e"; - assertTrue("c) Failed on equivalence", c.compare(o, o2) == 0); + assertEquals("c) Failed on equivalence", 0, c.compare(o, o2)); c.setStrength(Collator.PRIMARY); o = "E"; @@ -97,16 +97,16 @@ assertTrue("d) Failed on primary difference", c.compare(o, o2) < 0); o = "e"; o2 = "\u00e9"; - assertTrue("d) Failed on secondary difference", c.compare(o, o2) == 0); + assertEquals("d) Failed on secondary difference", 0, c.compare(o, o2)); o = "e"; o2 = "E"; - assertTrue("d) Failed on tertiary difference", c.compare(o, o2) == 0); + assertEquals("d) Failed on tertiary difference", 0, c.compare(o, o2)); o = "\u0001"; o2 = "\u0002"; - assertTrue("d) Failed on identical", c.compare(o, o2) == 0); + assertEquals("d) Failed on identical", 0, c.compare(o, o2)); o = "e"; o2 = "e"; - assertTrue("d) Failed on equivalence", c.compare(o, o2) == 0); + assertEquals("d) Failed on equivalence", 0, c.compare(o, o2)); try { c.compare("e", new StringBuffer("Blah")); Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java?rev=397158&r1=397157&r2=397158&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java Wed Apr 26 02:46:17 2006 @@ -48,7 +48,7 @@ public void test_ConstructorLjava_util_Locale() { DecimalFormatSymbols dfs = new DecimalFormatSymbols(new Locale("en", "us")); - assertTrue("Returned incorrect symbols", dfs.getPercent() == '%'); + assertEquals("Returned incorrect symbols", '%', dfs.getPercent()); } /** @@ -79,34 +79,34 @@ "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")); + assertEquals("Test1: Returned incorrect currencySymbol", "\uffe6", dfs1 + .getCurrencySymbol()); + assertEquals("Test1: Returned incorrect intlCurrencySymbol", "KRW", dfs1 + .getInternationalCurrencySymbol()); 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")); + assertEquals("Test2: Returned incorrect currencySymbol", "KRW", dfs1 + .getCurrencySymbol()); + assertEquals("Test2: Returned incorrect intlCurrencySymbol", "KRW", dfs1 + .getInternationalCurrencySymbol()); 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")); + assertEquals("Test3: Returned incorrect currencySymbol", "\u00a4", dfs1 + .getCurrencySymbol()); + assertEquals("Test3: Returned incorrect intlCurrencySymbol", "XXX", dfs1 + .getInternationalCurrencySymbol()); 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")); + assertEquals("Test4: Returned incorrect currencySymbol", "\u20ac", dfs1 + .getCurrencySymbol()); + assertEquals("Test4: Returned incorrect intlCurrencySymbol", "EUR", dfs1 + .getInternationalCurrencySymbol()); // RI fails these tests since it doesn't have the PREEURO variant // dfs1 = new DecimalFormatSymbols(new Locale("fr", "FR","PREEURO")); @@ -122,8 +122,8 @@ * @tests java.text.DecimalFormatSymbols#getCurrencySymbol() */ public void test_getCurrencySymbol() { - assertTrue("Returned incorrect currencySymbol", dfsUS - .getCurrencySymbol().equals("$")); + assertEquals("Returned incorrect currencySymbol", "$", dfsUS + .getCurrencySymbol()); } /** @@ -131,8 +131,8 @@ */ public void test_getDecimalSeparator() { dfs.setDecimalSeparator('*'); - assertTrue("Returned incorrect DecimalSeparator symbol", dfs - .getDecimalSeparator() == '*'); + assertEquals("Returned incorrect DecimalSeparator symbol", '*', dfs + .getDecimalSeparator()); } /** @@ -140,7 +140,7 @@ */ public void test_getDigit() { dfs.setDigit('*'); - assertTrue("Returned incorrect Digit symbol", dfs.getDigit() == '*'); + assertEquals("Returned incorrect Digit symbol", '*', dfs.getDigit()); } /** @@ -148,8 +148,8 @@ */ public void test_getGroupingSeparator() { dfs.setGroupingSeparator('*'); - assertTrue("Returned incorrect GroupingSeparator symbol", dfs - .getGroupingSeparator() == '*'); + assertEquals("Returned incorrect GroupingSeparator symbol", '*', dfs + .getGroupingSeparator()); } /** @@ -165,8 +165,8 @@ * @tests java.text.DecimalFormatSymbols#getInternationalCurrencySymbol() */ public void test_getInternationalCurrencySymbol() { - assertTrue("Returned incorrect InternationalCurrencySymbol", dfsUS - .getInternationalCurrencySymbol().equals("USD")); + assertEquals("Returned incorrect InternationalCurrencySymbol", "USD", dfsUS + .getInternationalCurrencySymbol()); } /** @@ -174,8 +174,8 @@ */ public void test_getMinusSign() { dfs.setMinusSign('&'); - assertTrue("Returned incorrect MinusSign symbol", - dfs.getMinusSign() == '&'); + assertEquals("Returned incorrect MinusSign symbol", + '&', dfs.getMinusSign()); } /** @@ -183,8 +183,8 @@ */ public void test_getNaN() { dfs.setNaN("NAN!!"); - assertTrue("Returned incorrect nan symbol", dfs.getNaN() - .equals("NAN!!")); + assertEquals("Returned incorrect nan symbol", "NAN!!", dfs.getNaN() + ); } /** @@ -192,8 +192,8 @@ */ public void test_getPatternSeparator() { dfs.setPatternSeparator('X'); - assertTrue("Returned incorrect PatternSeparator symbol", dfs - .getPatternSeparator() == 'X'); + assertEquals("Returned incorrect PatternSeparator symbol", 'X', dfs + .getPatternSeparator()); } /** @@ -201,7 +201,7 @@ */ public void test_getPercent() { dfs.setPercent('*'); - assertTrue("Returned incorrect Percent symbol", dfs.getPercent() == '*'); + assertEquals("Returned incorrect Percent symbol", '*', dfs.getPercent()); } /** @@ -209,7 +209,7 @@ */ public void test_getPerMill() { dfs.setPerMill('#'); - assertTrue("Returned incorrect PerMill symbol", dfs.getPerMill() == '#'); + assertEquals("Returned incorrect PerMill symbol", '#', dfs.getPerMill()); } /** @@ -217,8 +217,8 @@ */ public void test_getZeroDigit() { dfs.setZeroDigit('*'); - assertTrue("Returned incorrect ZeroDigit symbol", - dfs.getZeroDigit() == '*'); + assertEquals("Returned incorrect ZeroDigit symbol", + '*', dfs.getZeroDigit()); } /** @@ -250,8 +250,8 @@ */ public void test_setDecimalSeparatorC() { dfs.setDecimalSeparator('*'); - assertTrue("Returned incorrect DecimalSeparator symbol", dfs - .getDecimalSeparator() == '*'); + assertEquals("Returned incorrect DecimalSeparator symbol", '*', dfs + .getDecimalSeparator()); } /** @@ -259,7 +259,7 @@ */ public void test_setDigitC() { dfs.setDigit('*'); - assertTrue("Returned incorrect Digit symbol", dfs.getDigit() == '*'); + assertEquals("Returned incorrect Digit symbol", '*', dfs.getDigit()); } /** @@ -267,8 +267,8 @@ */ public void test_setGroupingSeparatorC() { dfs.setGroupingSeparator('*'); - assertTrue("Returned incorrect GroupingSeparator symbol", dfs - .getGroupingSeparator() == '*'); + assertEquals("Returned incorrect GroupingSeparator symbol", '*', dfs + .getGroupingSeparator()); } /** @@ -300,12 +300,12 @@ String symbol = dfs.getCurrencySymbol(); dfs.setInternationalCurrencySymbol("bogus"); - assertTrue("Test2: Returned incorrect currency", - dfs.getCurrency() == null); + assertNull("Test2: Returned incorrect currency", + dfs.getCurrency()); assertTrue("Test2: Returned incorrect currency symbol", dfs .getCurrencySymbol().equals(symbol)); - assertTrue("Test2: Returned incorrect international currency symbol", - dfs.getInternationalCurrencySymbol().equals("bogus")); + assertEquals("Test2: Returned incorrect international currency symbol", + "bogus", dfs.getInternationalCurrencySymbol()); } /** @@ -313,8 +313,8 @@ */ public void test_setMinusSignC() { dfs.setMinusSign('&'); - assertTrue("Returned incorrect MinusSign symbol", - dfs.getMinusSign() == '&'); + assertEquals("Returned incorrect MinusSign symbol", + '&', dfs.getMinusSign()); } /** @@ -322,8 +322,8 @@ */ public void test_setNaNLjava_lang_String() { dfs.setNaN("NAN!!"); - assertTrue("Returned incorrect nan symbol", dfs.getNaN() - .equals("NAN!!")); + assertEquals("Returned incorrect nan symbol", "NAN!!", dfs.getNaN() + ); } /** @@ -331,8 +331,8 @@ */ public void test_setPatternSeparatorC() { dfs.setPatternSeparator('X'); - assertTrue("Returned incorrect PatternSeparator symbol", dfs - .getPatternSeparator() == 'X'); + assertEquals("Returned incorrect PatternSeparator symbol", 'X', dfs + .getPatternSeparator()); } /** @@ -340,7 +340,7 @@ */ public void test_setPercentC() { dfs.setPercent('*'); - assertTrue("Returned incorrect Percent symbol", dfs.getPercent() == '*'); + assertEquals("Returned incorrect Percent symbol", '*', dfs.getPercent()); } /** @@ -348,7 +348,7 @@ */ public void test_setPerMillC() { dfs.setPerMill('#'); - assertTrue("Returned incorrect PerMill symbol", dfs.getPerMill() == '#'); + assertEquals("Returned incorrect PerMill symbol", '#', dfs.getPerMill()); } /** @@ -356,7 +356,7 @@ */ public void test_setZeroDigitC() { dfs.setZeroDigit('*'); - assertTrue("Set incorrect ZeroDigit symbol", dfs.getZeroDigit() == '*'); + assertEquals("Set incorrect ZeroDigit symbol", '*', dfs.getZeroDigit()); } /** Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java?rev=397158&r1=397157&r2=397158&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java Wed Apr 26 02:46:17 2006 @@ -730,13 +730,13 @@ */ public void test_applyPatternLjava_lang_String() { DecimalFormat format = new DecimalFormat("#.#"); - assertTrue("Wrong pattern 1", format.toPattern().equals("#0.#")); + assertEquals("Wrong pattern 1", "#0.#", format.toPattern()); format = new DecimalFormat("#."); - assertTrue("Wrong pattern 2", format.toPattern().equals("#0.")); + assertEquals("Wrong pattern 2", "#0.", format.toPattern()); format = new DecimalFormat("#"); - assertTrue("Wrong pattern 3", format.toPattern().equals("#")); + assertEquals("Wrong pattern 3", "#", format.toPattern()); format = new DecimalFormat(".#"); - assertTrue("Wrong pattern 4", format.toPattern().equals("#.0")); + assertEquals("Wrong pattern 4", "#.0", format.toPattern()); } /** @@ -1011,64 +1011,64 @@ 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")); + assertEquals("00.0#E0: 0", "00.0E0", df.format(0)); + assertEquals("00.0#E0: 1", "10.0E-1", df.format(1)); + assertEquals("00.0#E0: 12", "12.0E0", df.format(12)); + assertEquals("00.0#E0: 123", "12.3E1", df.format(123)); + assertEquals("00.0#E0: 1234", "12.34E2", df.format(1234)); + assertEquals("00.0#E0: 12346", "12.35E3", df.format(12346)); + assertEquals("00.0#E0: 99999", "10.0E4", df.format(99999)); + assertEquals("00.0#E0: -1", "-10.0E-1", df.format(-1)); + assertEquals("00.0#E0: -12", "-12.0E0", df.format(-12)); + assertEquals("00.0#E0: -123", "-12.3E1", df.format(-123)); + assertEquals("00.0#E0: -1234", "-12.34E2", df.format(-1234)); + assertEquals("00.0#E0: -12346", "-12.35E3", df.format(-12346)); + assertEquals("00.0#E0: -99999", "-10.0E4", df.format(-99999)); 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")); + assertEquals("##0.0E0: 0", "0.0E0", df.format(0)); + assertEquals("##0.0E0: 1", "1.0E0", df.format(1)); + assertEquals("##0.0E0: 12", "12E0", df.format(12)); + assertEquals("##0.0E0: 123", "123E0", df.format(123)); + assertEquals("##0.0E0: 1234", "1.234E3", df.format(1234)); + assertEquals("##0.0E0: 12346", "12.35E3", df.format(12346)); // 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")); + assertEquals("##0.0E0: 999999", "1.0E6", df.format(999999)); 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")); + assertEquals("#00.0##E0: 1", "1.00E0", df.format(1)); + assertEquals("#00.0##E0: 12", "12.0E0", df.format(12)); + assertEquals("#00.0##E0: 123", "123E0", df.format(123)); + assertEquals("#00.0##E0: 1234", "1.234E3", df.format(1234)); + assertEquals("#00.0##E0: 12345", "12.345E3", df.format(12345)); + assertEquals("#00.0##E0: 123456", "123.456E3", df.format(123456)); + assertEquals("#00.0##E0: 1234567", "1.23457E6", df.format(1234567)); + assertEquals("#00.0##E0: 12345678", + "12.3457E6", df.format(12345678)); + assertEquals("#00.0##E0: 99999999", "100E6", df.format(99999999)); 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")); + assertEquals("#.0E0: 0", ".0E0", df.format(0)); + assertEquals("#.0E0: 1", ".1E1", df.format(1)); + assertEquals("#.0E0: 12", ".12E2", df.format(12)); + assertEquals("#.0E0: 123", ".12E3", df.format(123)); + assertEquals("#.0E0: 1234", ".12E4", df.format(1234)); + assertEquals("#.0E0: 9999", ".1E5", df.format(9999)); 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")); + assertEquals("0.#E0: 0", "0E0", df.format(0)); + assertEquals("0.#E0: 1", "1E0", df.format(1)); + assertEquals("0.#E0: 12", "1.2E1", df.format(12)); + assertEquals("0.#E0: 123", "1.2E2", df.format(123)); + assertEquals("0.#E0: 1234", "1.2E3", df.format(1234)); + assertEquals("0.#E0: 9999", "1E4", df.format(9999)); assertTrue("Failed " + failures + " of " + failCount, failures.length() == 0); @@ -1183,11 +1183,11 @@ */ public void test_getGroupingSize() { DecimalFormat df = new DecimalFormat("###0.##"); - assertTrue("Wrong unset size", df.getGroupingSize() == 0); + assertEquals("Wrong unset size", 0, df.getGroupingSize()); df = new DecimalFormat("#,##0.##"); - assertTrue("Wrong set size", df.getGroupingSize() == 3); + assertEquals("Wrong set size", 3, df.getGroupingSize()); df = new DecimalFormat("#,###,###0.##"); - assertTrue("Wrong multiple set size", df.getGroupingSize() == 4); + assertEquals("Wrong multiple set size", 4, df.getGroupingSize()); } /** @@ -1200,11 +1200,11 @@ assertEquals(defaultMultiplier, form.getMultiplier()); DecimalFormat df = new DecimalFormat("###0.##"); - assertTrue("Wrong unset multiplier", df.getMultiplier() == 1); + assertEquals("Wrong unset multiplier", 1, df.getMultiplier()); df = new DecimalFormat("###0.##%"); - assertTrue("Wrong percent multiplier", df.getMultiplier() == 100); + assertEquals("Wrong percent multiplier", 100, df.getMultiplier()); df = new DecimalFormat("###0.##\u2030"); - assertTrue("Wrong mille multiplier", df.getMultiplier() == 1000); + assertEquals("Wrong mille multiplier", 1000, df.getMultiplier()); } /** @@ -1322,7 +1322,7 @@ dfs.setDecimalSeparator('@'); df.setDecimalFormatSymbols(dfs); assertTrue("Not set", df.getDecimalFormatSymbols().equals(dfs)); - assertTrue("Symbols not used", df.format(1.2).equals("1@2")); + assertEquals("Symbols not used", "1@2", df.format(1.2)); // The returned symbols may be cloned in two spots // 1. When set @@ -1339,10 +1339,10 @@ */ public void test_setDecimalSeparatorAlwaysShownZ() { DecimalFormat df = new DecimalFormat("###0.##"); - assertTrue("Wrong default result", df.format(5).equals("5")); + assertEquals("Wrong default result", "5", df.format(5)); df.setDecimalSeparatorAlwaysShown(true); assertTrue("Not set", df.isDecimalSeparatorAlwaysShown()); - assertTrue("Wrong set result", df.format(7).equals("7.")); + assertEquals("Wrong set result", "7.", df.format(7)); } /** @@ -1379,7 +1379,7 @@ new DecimalFormatSymbols(Locale.ENGLISH)); df.setGroupingUsed(true); df.setGroupingSize(2); - assertTrue("Value not set", df.getGroupingSize() == 2); + assertEquals("Value not set", 2, df.getGroupingSize()); String result = df.format(123); assertTrue("Invalid format:" + result, result.equals("1,23")); } @@ -1390,11 +1390,11 @@ 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")); + assertEquals("Not set", 3, df.getMaximumFractionDigits()); + assertEquals("Wrong maximum", "1.235", df.format(1.23456)); df.setMinimumFractionDigits(4); - assertTrue("Not changed", df.getMaximumFractionDigits() == 4); - assertTrue("Incorrect fraction", df.format(456).equals("456.0000")); + assertEquals("Not changed", 4, df.getMaximumFractionDigits()); + assertEquals("Incorrect fraction", "456.0000", df.format(456)); } /** @@ -1403,11 +1403,11 @@ 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")); + assertEquals("Not set", 2, df.getMaximumIntegerDigits()); + assertEquals("Wrong maximum", "34", df.format(1234)); df.setMinimumIntegerDigits(4); - assertTrue("Not changed", df.getMaximumIntegerDigits() == 4); - assertTrue("Incorrect integer", df.format(26).equals("0026")); + assertEquals("Not changed", 4, df.getMaximumIntegerDigits()); + assertEquals("Incorrect integer", "0026", df.format(26)); } /** @@ -1416,11 +1416,11 @@ 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")); + assertEquals("Not set", 4, df.getMinimumFractionDigits()); + assertEquals("Wrong minimum", "1.2300", df.format(1.23)); df.setMaximumFractionDigits(2); - assertTrue("Not changed", df.getMinimumFractionDigits() == 2); - assertTrue("Incorrect fraction", df.format(456).equals("456.00")); + assertEquals("Not changed", 2, df.getMinimumFractionDigits()); + assertEquals("Incorrect fraction", "456.00", df.format(456)); } /** @@ -1429,11 +1429,11 @@ 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")); + assertEquals("Not set", 3, df.getMinimumIntegerDigits()); + assertEquals("Wrong minimum", "012", df.format(12)); df.setMaximumIntegerDigits(2); - assertTrue("Not changed", df.getMinimumIntegerDigits() == 2); - assertTrue("Incorrect integer", df.format(0.7).equals("00.7")); + assertEquals("Not changed", 2, df.getMinimumIntegerDigits()); + assertEquals("Incorrect integer", "00.7", df.format(0.7)); } /** @@ -1442,9 +1442,9 @@ 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); + assertEquals("Wrong multiplier", 10, df.getMultiplier()); + assertEquals("Wrong format", "50", df.format(5)); + assertEquals("Wrong parse", 5, df.parse("50", new ParsePosition(0)) + .intValue()); } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/FieldPositionTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/FieldPositionTest.java?rev=397158&r1=397157&r2=397158&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/FieldPositionTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/FieldPositionTest.java Wed Apr 26 02:46:17 2006 @@ -110,8 +110,8 @@ FieldPosition fpos = new FieldPosition(1); fpos.setEndIndex(3); fpos.setBeginIndex(2); - assertTrue("getBeginIndex should have returned 2", - fpos.getBeginIndex() == 2); + assertEquals("getBeginIndex should have returned 2", + 2, fpos.getBeginIndex()); } /** @@ -122,8 +122,8 @@ FieldPosition fpos = new FieldPosition(1); fpos.setBeginIndex(2); fpos.setEndIndex(3); - assertTrue("getEndIndex should have returned 3", - fpos.getEndIndex() == 3); + assertEquals("getEndIndex should have returned 3", + 3, fpos.getEndIndex()); } /** @@ -132,13 +132,11 @@ 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); + assertEquals("FieldPosition(65) should have caused getField to return 65", + 65, fpos.getField()); FieldPosition fpos2 = new FieldPosition(DateFormat.Field.MINUTE); - assertTrue( - "FieldPosition(DateFormat.Field.MINUTE) should have caused getField to return -1", - fpos2.getField() == -1); + assertEquals("FieldPosition(DateFormat.Field.MINUTE) should have caused getField to return -1", + -1, fpos2.getField()); } /** @@ -152,9 +150,9 @@ fpos.getFieldAttribute() == DateFormat.Field.TIME_ZONE); FieldPosition fpos2 = new FieldPosition(DateFormat.TIMEZONE_FIELD); - assertTrue( + assertNull( "FieldPosition(DateFormat.TIMEZONE_FIELD) should have caused getFieldAttribute to return null", - fpos2.getFieldAttribute() == null); + fpos2.getFieldAttribute()); } /** @@ -183,8 +181,8 @@ FieldPosition fpos = new FieldPosition(1); fpos.setBeginIndex(2); fpos.setEndIndex(3); - assertTrue("beginIndex should have been set to 2", - fpos.getBeginIndex() == 2); + assertEquals("beginIndex should have been set to 2", + 2, fpos.getBeginIndex()); } /** @@ -195,8 +193,8 @@ FieldPosition fpos = new FieldPosition(1); fpos.setEndIndex(3); fpos.setBeginIndex(2); - assertTrue("EndIndex should have been set to 3", - fpos.getEndIndex() == 3); + assertEquals("EndIndex should have been set to 3", + 3, fpos.getEndIndex()); } /** Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java?rev=397158&r1=397157&r2=397158&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java Wed Apr 26 02:46:17 2006 @@ -93,7 +93,7 @@ assertTrue("Not a MessageFormat", format.getClass() == MessageFormat.class); Format[] formats = format.getFormats(); - assertTrue("null formats", formats != null); + assertNotNull("null formats", formats); assertTrue("Wrong format count: " + formats.length, formats.length >= 5); assertTrue("Wrong time format", formats[0].equals(DateFormat .getTimeInstance())); @@ -103,7 +103,7 @@ .getInstance())); assertTrue("Wrong choice format", formats[3].equals(new ChoiceFormat( "0.0#low|1.0#high"))); - assertTrue("Wrong string format", formats[4] == null); + assertNull("Wrong string format", formats[4]); Date date = new Date(); FieldPosition pos = new FieldPosition(-1); @@ -122,8 +122,8 @@ 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")); + assertEquals("Simple string", "Test message", new MessageFormat("Test message").format( + new Object[0])); try { result = new MessageFormat("Don't").format(new Object[0]); @@ -178,8 +178,8 @@ // 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")); + assertEquals("Invalid number", "xx 46", format.format( + new Object[] { new Integer(46) })); Date date = new Date(); String result = format.format(new Object[] { date }); String expected = "xx " + DateFormat.getInstance().format(date); @@ -187,110 +187,110 @@ .equals(expected)); format = new MessageFormat("{0,date}{1,time}{2,number,integer}"); format.applyPattern("nothing"); - assertTrue("Found formats", format.toPattern().equals("nothing")); + assertEquals("Found formats", "nothing", format.toPattern()); format.applyPattern("{0}"); - assertTrue("Wrong format", format.getFormats()[0] == null); - assertTrue("Wrong pattern", format.toPattern().equals("{0}")); + assertNull("Wrong format", format.getFormats()[0]); + assertEquals("Wrong pattern", "{0}", format.toPattern()); format.applyPattern("{0, \t\u001ftime }"); assertTrue("Wrong time format", format.getFormats()[0] .equals(DateFormat.getTimeInstance())); - assertTrue("Wrong time pattern", format.toPattern().equals("{0,time}")); + assertEquals("Wrong time pattern", "{0,time}", format.toPattern()); 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}")); + assertEquals("Wrong short time pattern", + "{0,time,short}", format.toPattern()); 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}")); + assertEquals("Wrong medium time pattern", + "{0,time}", format.toPattern()); 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}")); + assertEquals("Wrong long time pattern", + "{0,time,long}", format.toPattern()); 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}")); + assertEquals("Wrong full time pattern", + "{0,time,full}", format.toPattern()); 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}")); + assertEquals("Wrong date pattern", "{0,date}", format.toPattern()); 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}")); + assertEquals("Wrong short date pattern", + "{0,date,short}", format.toPattern()); 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}")); + assertEquals("Wrong medium date pattern", + "{0,date}", format.toPattern()); 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}")); + assertEquals("Wrong long date pattern", + "{0,date,long}", format.toPattern()); 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}")); + assertEquals("Wrong full date pattern", + "{0,date,full}", format.toPattern()); 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}}")); + assertEquals("Wrong time/date format", " MMM d {hh:mm:ss}", ((SimpleDateFormat) (format + .getFormats()[0])).toPattern()); + assertEquals("Wrong time/date pattern", + "{0,date, MMM d {hh:mm:ss}}", format.toPattern()); format.applyPattern("{0, number}"); assertTrue("Wrong number format", format.getFormats()[0] .equals(NumberFormat.getNumberInstance())); - assertTrue("Wrong number pattern", format.toPattern().equals( - "{0,number}")); + assertEquals("Wrong number pattern", + "{0,number}", format.toPattern()); 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}")); + assertEquals("Wrong currency number pattern", + "{0,number,currency}", format.toPattern()); 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}")); + assertEquals("Wrong percent number pattern", + "{0,number,percent}", format.toPattern()); 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}")); + assertEquals("Wrong integer number pattern", + "{0,number,integer}", format.toPattern()); 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}")); + assertEquals("Wrong pattern number format", "' {#}'##0.0E0", ((DecimalFormat) (format + .getFormats()[0])).toPattern()); + assertEquals("Wrong pattern number pattern", + "{0,number,' {#}'##0.0E0}", format.toPattern()); 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")); + assertEquals("Wrong choice format", + + "0.0#no|1.0#one|2.0#{1,number}", ((ChoiceFormat) format.getFormats()[0]).toPattern()); + assertEquals("Wrong choice pattern", + "{0,choice,0.0#no|1.0#one|2.0#{1,number}}", format.toPattern()); + assertEquals("Wrong formatted choice", "3.6", format.format( + new Object[] { new Integer(2), new Float(3.6) })); try { format.applyPattern("WRONG MESSAGE FORMAT {0,number,{}"); @@ -317,8 +317,8 @@ 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}")); + assertEquals("Wrong answer", + "{choice}{0}", format.format(new Object[] {})); clone.setFormat(0, DateFormat.getInstance()); assertTrue("Clone shares format data", !format.equals(clone)); format = (MessageFormat) clone.clone(); @@ -366,7 +366,7 @@ StringBuffer buffer = new StringBuffer(); format.format(new Object[] { "0", new Double(53.863) }, buffer, new FieldPosition(0)); - assertTrue("Wrong result", buffer.toString().equals("54")); + assertEquals("Wrong result", "54", buffer.toString()); format .applyPattern("{0,choice,0#zero|1#one '{1,choice,2#two {2,time}}'}"); Date date = new Date(); @@ -665,7 +665,7 @@ 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")); + assertEquals("Wrong variable result", "c", result[0]); } /** Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/NumberFormatTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/NumberFormatTest.java?rev=397158&r1=397157&r2=397158&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/NumberFormatTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/NumberFormatTest.java Wed Apr 26 02:46:17 2006 @@ -200,7 +200,7 @@ public void test_getMaximumIntegerDigits() { NumberFormat format = NumberFormat.getInstance(); format.setMaximumIntegerDigits(2); - assertTrue("Wrong result", format.format(123).equals("23")); + assertEquals("Wrong result", "23", format.format(123)); } /** Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParseExceptionTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParseExceptionTest.java?rev=397158&r1=397157&r2=397158&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParseExceptionTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParseExceptionTest.java Wed Apr 26 02:46:17 2006 @@ -44,7 +44,7 @@ DateFormat df = DateFormat.getInstance(); df.parse("1999HelloWorld"); } catch (ParseException e) { - assertTrue("getErrorOffsetFailed.", e.getErrorOffset() == 4); + assertEquals("getErrorOffsetFailed.", 4, e.getErrorOffset()); } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParsePositionTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParsePositionTest.java?rev=397158&r1=397157&r2=397158&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParsePositionTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParsePositionTest.java Wed Apr 26 02:46:17 2006 @@ -29,7 +29,7 @@ ParsePosition pp1 = new ParsePosition(Integer.MIN_VALUE); assertTrue("Initialization failed.", pp1.getIndex() == Integer.MIN_VALUE); - assertTrue("Initialization failed.", pp1.getErrorIndex() == -1); + assertEquals("Initialization failed.", -1, pp1.getErrorIndex()); } catch (Exception e) { fail("Constructor failed."); } @@ -56,7 +56,7 @@ public void test_getErrorIndex() { // Test for method int java.text.ParsePosition.getErrorIndex() pp.setErrorIndex(56); - assertTrue("getErrorIndex failed.", pp.getErrorIndex() == 56); + assertEquals("getErrorIndex failed.", 56, pp.getErrorIndex()); } /** @@ -82,7 +82,7 @@ public void test_setErrorIndexI() { // Test for method void java.text.ParsePosition.setErrorIndex(int) pp.setErrorIndex(4564); - assertTrue("setErrorIndex failed.", pp.getErrorIndex() == 4564); + assertEquals("setErrorIndex failed.", 4564, pp.getErrorIndex()); } /** @@ -91,7 +91,7 @@ public void test_setIndexI() { // Test for method void java.text.ParsePosition.setIndex(int) pp.setIndex(4564); - assertTrue("setErrorIndex failed.", pp.getIndex() == 4564); + assertEquals("setErrorIndex failed.", 4564, pp.getIndex()); } /** @@ -99,8 +99,8 @@ */ public void test_toString() { // Test for method java.lang.String java.text.ParsePosition.toString() - assertTrue("toString failed.", pp.toString().equals( - "java.text.ParsePosition[index=2147483647, errorIndex=-1]")); + assertEquals("toString failed.", + "java.text.ParsePosition[index=2147483647, errorIndex=-1]", pp.toString()); } /** Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java?rev=397158&r1=397157&r2=397158&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java Wed Apr 26 02:46:17 2006 @@ -124,7 +124,7 @@ // Test for method java.text.SimpleDateFormat(java.lang.String) SimpleDateFormat f2 = new SimpleDateFormat("yyyy"); assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class); - assertTrue("Wrong pattern", f2.toPattern().equals("yyyy")); + assertEquals("Wrong pattern", "yyyy", f2.toPattern()); assertTrue("Wrong locale", f2.equals(new SimpleDateFormat("yyyy", Locale.getDefault()))); assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals( @@ -168,7 +168,7 @@ symbols.setEras(new String[] { "Before", "After" }); SimpleDateFormat f2 = new SimpleDateFormat("y'y'yy", symbols); assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class); - assertTrue("Wrong pattern", f2.toPattern().equals("y'y'yy")); + assertEquals("Wrong pattern", "y'y'yy", f2.toPattern()); assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals(symbols)); assertTrue("Doesn't work", f2.format(new Date()).getClass() == String.class); @@ -184,7 +184,7 @@ SimpleDateFormat f2 = new SimpleDateFormat("'yyyy' MM yy", Locale.GERMAN); assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class); - assertTrue("Wrong pattern", f2.toPattern().equals("'yyyy' MM yy")); + assertEquals("Wrong pattern", "'yyyy' MM yy", f2.toPattern()); assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals( new DateFormatSymbols(Locale.GERMAN))); assertTrue("Doesn't work", @@ -243,7 +243,7 @@ // java.text.SimpleDateFormat.applyPattern(java.lang.String) SimpleDateFormat f2 = new SimpleDateFormat("y", new Locale("de", "CH")); f2.applyPattern("GyMdkHmsSEDFwWahKz"); - assertTrue("Wrong pattern", f2.toPattern().equals("GyMdkHmsSEDFwWahKz")); + assertEquals("Wrong pattern", "GyMdkHmsSEDFwWahKz", f2.toPattern()); // test invalid patterns try { @@ -483,7 +483,7 @@ test.test(" z", cal, " GMT-01:30", DateFormat.TIMEZONE_FIELD); format.applyPattern("'Mkz''':.@5"); - assertTrue("Wrong output", format.format(new Date()).equals("Mkz':.@5")); + assertEquals("Wrong output", "Mkz':.@5", format.format(new Date())); assertTrue("Tests failed", !test.testsFailed()); @@ -785,16 +785,16 @@ Calendar cal = new GregorianCalendar(); try { cal.setTime(f1.parse("49")); - assertTrue("Incorrect year 2049", cal.get(Calendar.YEAR) == 2049); + assertEquals("Incorrect year 2049", 2049, cal.get(Calendar.YEAR)); cal.setTime(f1.parse("50")); int year = cal.get(Calendar.YEAR); assertTrue("Incorrect year 1950: " + year, year == 1950); f1.applyPattern("y"); cal.setTime(f1.parse("00")); - assertTrue("Incorrect year 2000", cal.get(Calendar.YEAR) == 2000); + assertEquals("Incorrect year 2000", 2000, cal.get(Calendar.YEAR)); f1.applyPattern("yyy"); cal.setTime(f1.parse("50")); - assertTrue("Incorrect year 50", cal.get(Calendar.YEAR) == 50); + assertEquals("Incorrect year 50", 50, cal.get(Calendar.YEAR)); } catch (ParseException e) { fail("ParseException"); } @@ -815,7 +815,7 @@ assertTrue("Not a clone", f1.getDateFormatSymbols() != symbols); String result = f1.format(new GregorianCalendar(1999, Calendar.JUNE, 12, 3, 0).getTime()); - assertTrue("Incorrect symbols used", result.equals("morning")); + assertEquals("Incorrect symbols used", "morning", result); symbols.setEras(new String[] { "before", "after" }); assertTrue("Identical symbols", !f1.getDateFormatSymbols().equals( symbols)); Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/StringCharacterIteratorTest.java URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/StringCharacterIteratorTest.java?rev=397158&r1=397157&r2=397158&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/StringCharacterIteratorTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/StringCharacterIteratorTest.java Wed Apr 26 02:46:17 2006 @@ -165,9 +165,9 @@ fixture.next(); assertEquals('i', fixture.current()); - StringCharacterIterator it = new StringCharacterIterator("testing", 2, - 6, 4); - assertTrue("Wrong current char", it.current() == 'i'); + StringCharacterIterator it = + new StringCharacterIterator("testing", 2, 6, 4); + assertEquals("Wrong current char", 'i', it.current()); } /** @@ -184,12 +184,12 @@ 2); assertEquals('i', fixture.first()); - StringCharacterIterator it1 = new StringCharacterIterator("testing", 2, - 6, 4); - assertTrue("Wrong first char", it1.first() == 's'); - assertTrue("Wrong next char", it1.next() == 't'); - it1 = new StringCharacterIterator("testing", 2, 2, 2); - assertTrue("Not DONE", it1.first() == CharacterIterator.DONE); + StringCharacterIterator it1 = + new StringCharacterIterator("testing", 2, 6, 4); + assertEquals("Wrong first char", 's', it1.first()); + assertEquals("Wrong next char", 't', it1.next()); + it1 = new StringCharacterIterator("testing", 2, 2, 2); + assertTrue("Not DONE", it1.first() == CharacterIterator.DONE); } /** @@ -204,9 +204,9 @@ 2); assertEquals(1, fixture.getBeginIndex()); - StringCharacterIterator it1 = new StringCharacterIterator("testing", 2, - 6, 4); - assertTrue("Wrong begin index 2", it1.getBeginIndex() == 2); + StringCharacterIterator it1 = + new StringCharacterIterator("testing", 2, 6, 4); + assertEquals("Wrong begin index 2", 2, it1.getBeginIndex()); } /** @@ -223,9 +223,9 @@ fixture = new StringCharacterIterator("fixture", 1, 4, 2); assertEquals(4, fixture.getEndIndex()); - StringCharacterIterator it1 = new StringCharacterIterator("testing", 2, - 6, 4); - assertTrue("Wrong end index 6", it1.getEndIndex() == 6); + StringCharacterIterator it1 = + new StringCharacterIterator("testing", 2, 6, 4); + assertEquals("Wrong end index 6", 6, it1.getEndIndex()); } /** @@ -288,14 +288,14 @@ StringCharacterIterator it1 = new StringCharacterIterator("testing", 2, 6, 3); char result = it1.next(); - assertTrue("Wrong next char1: " + result, result == 'i'); - assertTrue("Wrong next char2", it1.next() == 'n'); + assertEquals("Wrong next char1", 'i', result); + assertEquals("Wrong next char2", 'n', it1.next()); assertTrue("Wrong next char3", it1.next() == CharacterIterator.DONE); assertTrue("Wrong next char4", it1.next() == CharacterIterator.DONE); int index = it1.getIndex(); - assertTrue("Wrong index: " + index, index == 6); + assertEquals("Wrong index", 6, index); assertTrue("Wrong current char", - it1.current() == CharacterIterator.DONE); + it1.current() == CharacterIterator.DONE); } /** @@ -331,16 +331,16 @@ assertEquals(CharacterIterator.DONE, fixture.previous()); assertEquals(0, fixture.getIndex()); - StringCharacterIterator it1 = new StringCharacterIterator("testing", 2, - 6, 4); - assertTrue("Wrong previous char1", it1.previous() == 't'); - assertTrue("Wrong previous char2", it1.previous() == 's'); - assertTrue("Wrong previous char3", - it1.previous() == CharacterIterator.DONE); - assertTrue("Wrong previous char4", - it1.previous() == CharacterIterator.DONE); - assertTrue("Wrong index", it1.getIndex() == 2); - assertTrue("Wrong current char", it1.current() == 's'); + StringCharacterIterator it1 = + new StringCharacterIterator("testing", 2, 6, 4); + assertEquals("Wrong previous char1", 't', it1.previous()); + assertEquals("Wrong previous char2", 's', it1.previous()); + assertTrue("Wrong previous char3", + it1.previous() == CharacterIterator.DONE); + assertTrue("Wrong previous char4", + it1.previous() == CharacterIterator.DONE); + assertEquals("Wrong index", 2, it1.getIndex()); + assertEquals("Wrong current char", 's', it1.current()); } /** @@ -403,11 +403,11 @@ } StringCharacterIterator it = new StringCharacterIterator("testing"); - assertTrue("Wrong begin index", it.getBeginIndex() == 0); - assertTrue("Wrong end index", it.getEndIndex() == 7); - assertTrue("Wrong current index", it.getIndex() == 0); - assertTrue("Wrong current char", it.current() == 't'); - assertTrue("Wrong next char", it.next() == 'e'); + assertEquals("Wrong begin index", 0, it.getBeginIndex()); + assertEquals("Wrong end index", 7, it.getEndIndex()); + assertEquals("Wrong current index", 0, it.getIndex()); + assertEquals("Wrong current char", 't', it.current()); + assertEquals("Wrong next char", 'e', it.next()); } /** @@ -416,11 +416,11 @@ */ public void test_ConstructorLjava_lang_StringI() { StringCharacterIterator it = new StringCharacterIterator("testing", 3); - assertTrue("Wrong begin index", it.getBeginIndex() == 0); - assertTrue("Wrong end index", it.getEndIndex() == 7); - assertTrue("Wrong current index", it.getIndex() == 3); - assertTrue("Wrong current char", it.current() == 't'); - assertTrue("Wrong next char", it.next() == 'i'); + assertEquals("Wrong begin index", 0, it.getBeginIndex()); + assertEquals("Wrong end index", 7, it.getEndIndex()); + assertEquals("Wrong current index", 3, it.getIndex()); + assertEquals("Wrong current char", 't', it.current()); + assertEquals("Wrong next char", 'i', it.next()); } /** @@ -430,11 +430,11 @@ public void test_ConstructorLjava_lang_StringIII() { StringCharacterIterator it = new StringCharacterIterator("testing", 2, 6, 4); - assertTrue("Wrong begin index", it.getBeginIndex() == 2); - assertTrue("Wrong end index", it.getEndIndex() == 6); - assertTrue("Wrong current index", it.getIndex() == 4); - assertTrue("Wrong current char", it.current() == 'i'); - assertTrue("Wrong next char", it.next() == 'n'); + assertEquals("Wrong begin index", 2, it.getBeginIndex()); + assertEquals("Wrong end index", 6, it.getEndIndex()); + assertEquals("Wrong current index", 4, it.getIndex()); + assertEquals("Wrong current char", 'i', it.current()); + assertEquals("Wrong next char", 'n', it.next()); } /** @@ -443,11 +443,11 @@ public void test_getIndex() { StringCharacterIterator it1 = new StringCharacterIterator("testing", 2, 6, 4); - assertTrue("Wrong index 4", it1.getIndex() == 4); + assertEquals("Wrong index 4", 4, it1.getIndex()); it1.next(); - assertTrue("Wrong index 5", it1.getIndex() == 5); + assertEquals("Wrong index 5", 5, it1.getIndex()); it1.last(); - assertTrue("Wrong index 4/2", it1.getIndex() == 5); + assertEquals("Wrong index 4/2", 5, it1.getIndex()); } /** @@ -486,8 +486,8 @@ public void test_last() { StringCharacterIterator it1 = new StringCharacterIterator("testing", 2, 6, 3); - assertTrue("Wrong last char", it1.last() == 'n'); - assertTrue("Wrong previous char", it1.previous() == 'i'); + assertEquals("Wrong last char", 'n', it1.last()); + assertEquals("Wrong previous char", 'i', it1.previous()); it1 = new StringCharacterIterator("testing", 2, 2, 2); assertTrue("Not DONE", it1.last() == CharacterIterator.DONE); } @@ -498,11 +498,11 @@ public void test_setIndexI() { StringCharacterIterator it1 = new StringCharacterIterator("testing", 2, 6, 4); - assertTrue("Wrong result1", it1.setIndex(2) == 's'); + assertEquals("Wrong result1", 's', it1.setIndex(2)); char result = it1.next(); assertTrue("Wrong next char: " + result, result == 't'); assertTrue("Wrong result2", it1.setIndex(6) == CharacterIterator.DONE); - assertTrue("Wrong previous char", it1.previous() == 'n'); + assertEquals("Wrong previous char", 'n', it1.previous()); } /** @@ -512,8 +512,8 @@ StringCharacterIterator it1 = new StringCharacterIterator("testing", 2, 6, 4); it1.setText("frog"); - assertTrue("Wrong begin index", it1.getBeginIndex() == 0); - assertTrue("Wrong end index", it1.getEndIndex() == 4); - assertTrue("Wrong current index", it1.getIndex() == 0); + assertEquals("Wrong begin index", 0, it1.getBeginIndex()); + assertEquals("Wrong end index", 4, it1.getEndIndex()); + assertEquals("Wrong current index", 0, it1.getIndex()); } }