jdk/test/sun/util/resources/Locale/Bug6275682.java
author weijun
Thu, 08 Sep 2011 09:04:28 +0800
changeset 10435 e9df9d264894
parent 2 90ce3da70b43
child 21596 0e3a39f29dbc
permissions -rw-r--r--
7087428: move client tests out of jdk_misc Reviewed-by: alanb, ohair
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
    @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
    @summary Verifying that the language names starts with lowercase in spanish
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
    @bug 6275682
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
import java.util.Locale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
public class Bug6275682 {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
   public static void main (String[] args) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
        Locale es = new Locale ("es");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
        String[] isoLangs = es.getISOLanguages ();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
        String error = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
        for (int i = 0; i < isoLangs.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
            Locale current = new Locale (isoLangs[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
            String localeString = current.getDisplayLanguage (es);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
            String startLetter = localeString.substring (0,1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
            if (!startLetter.toLowerCase (es).equals (startLetter)){
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
                error = error + "\n\t"+ isoLangs[i] + " " + localeString;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
        if (error.length () > 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
            throw new Exception ("\nFollowing language names starts with upper-case letter: "
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
                    + error + "\nLower-case expected!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
}