The last import in TreeMapStringStringTest.java is unnecessary. Will remove
it when I commit the patch.

On Wed, May 13, 2009 at 4:15 PM, <[email protected]> wrote:

> Reviewers: jat, scottb,
>
> Description:
> Simple fix and accompanying testcase for toString() method in
> TreeMap.Entry
>
> Please review this at http://gwt-code-reviews.appspot.com/33814
>
> Affected files:
>  user/super/com/google/gwt/emul/java/util/TreeMap.java
>  user/test/com/google/gwt/emultest/java/util/TreeMapStringStringTest.java
>
>
> Index: user/super/com/google/gwt/emul/java/util/TreeMap.java
> --- user/super/com/google/gwt/emul/java/util/TreeMap.java       (revision
> 3877)
> +++ user/super/com/google/gwt/emul/java/util/TreeMap.java       (working
> copy)
> @@ -234,7 +234,8 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
> implements
>
>     @Override
>     public String toString() {
> -      return (isRed ? "R: " : "B: ") + key + "=" + value;
> +      // for compatibility with the real Jre: issue 3422
> +      return key + "=" + value;
>     }
>   }
>
> Index:
> user/test/com/google/gwt/emultest/java/util/TreeMapStringStringTest.java
> ---
> user/test/com/google/gwt/emultest/java/util/TreeMapStringStringTest.java
>    (revision 3589)
> +++
> user/test/com/google/gwt/emultest/java/util/TreeMapStringStringTest.java
>    (working copy)
> @@ -16,9 +16,12 @@
>  package com.google.gwt.emultest.java.util;
>
>  import java.util.Iterator;
> +import java.util.Map;
>  import java.util.NoSuchElementException;
>  import java.util.Set;
>  import java.util.SortedMap;
> +import java.util.TreeMap;
> +import java.util.Map.Entry;
>
>  /**
>  * Tests <code>TreeMap</code> with Strings and the natural comparator.
> @@ -118,6 +121,15 @@ public class TreeMapStringStringTest extends
> TreeMapTest<String, String> {
>     assertEquals("lastKey", "dd", subMap.lastKey());
>   }
>
> +  // checks for compatibility with real Jre's Entry.toString(): issue 3422
> +  public void testTreeMapEntryToString() {
> +    Map<String, String> treeMap = new TreeMap<String, String>();
> +    treeMap.put("bar", "barValue");
> +
> +    assertEquals("bar=barValue",
> +        treeMap.entrySet().iterator().next().toString());
> +  }
> +
>   @Override
>   protected Object getConflictingKey() {
>     return new Integer(1);
>
>
>
>

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to