You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by enh <en...@google.com> on 2010/03/10 02:25:05 UTC

StringTest.test_getBytesLCharset

can anyone explain this test?

       byte[] someBytes = new byte[]{'T','h','i','s',' ','
','i','s',' ','t','e','s','t',' ','b','y','t','e','s'};
...
       SortedMap<String, Charset> charsets = Charset.availableCharsets();
...
       if (charsets.size() >= 2){
           assertTrue(bytesEquals(someBytes,new String(someBytes,
charsets.get(charsets.firstKey())).getBytes(charsets.get(charsets.lastKey()))));

i don't understand why it's necessarily true that we can roundtrip
between the first and last charsets in the map. surely that depends on
the exact contents of the map? or am i missing something?

was the intention to iterate through the map and try to round-trip for
each charset in the map?

(this is on the java 6 branch.)

-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/