harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r427430 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/Scanner.java test/java/tests/api/java/util/ScannerTest.java
Date Tue, 01 Aug 2006 03:34:35 GMT
Author: pyang
Date: Mon Jul 31 20:34:35 2006
New Revision: 427430

URL: http://svn.apache.org/viewvc?rev=427430&view=rev
Log:
Fix for HARMONY-1012 ( [classlib][luni] Implementation of new method java.util.Scanner.toString())

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ScannerTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java?rev=427430&r1=427429&r2=427430&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java
Mon Jul 31 20:34:35 2006
@@ -1658,9 +1658,22 @@
         return skip(Pattern.compile(pattern));
     }
 
-    //TODO: To implement this feature
+    /**
+     * Returns a string. The string is used to represent this scanner. Contained
+     * information may be helpful for debugging. The format of the string is
+     * unspecified.
+     * 
+     * @return a string to represent this scanner
+     */
     public String toString() {
-        throw new NotYetImplementedException();
+        StringBuilder stringBuilder = new StringBuilder();
+        stringBuilder.append(this.getClass()).append(": ") //$NON-NLS-1$
+                .append("{(delimiter:") //$NON-NLS-1$
+                .append(delimiter).append(")(findStartIndex=") //$NON-NLS-1$
+                .append(findStartIndex).append(")(match succeed=") //$NON-NLS-1$
+                .append(matchSuccessful).append(")(closed=") //$NON-NLS-1$
+                .append(closed).append(")}"); //$NON-NLS-1$
+        return stringBuilder.toString();
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ScannerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ScannerTest.java?rev=427430&r1=427429&r2=427430&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ScannerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ScannerTest.java
Mon Jul 31 20:34:35 2006
@@ -5231,7 +5231,15 @@
         s.useLocale(Locale.ENGLISH);
         assertEquals(new BigDecimal("-123.4"), s.nextBigDecimal());
     }
-    
+
+    /**
+     * @tests java.util.Scanner#toString()
+     */
+    public void test_toString() {
+        s = new Scanner("test");
+        assertNotNull(s.toString());
+    }
+
     /**
      * @tests java.util.Scanner#nextLine()
      */



Mime
View raw message