Path: blob/master/test/jdk/java/util/ResourceBundle/Bug4177489Test.java
41149 views
/*1* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/22/*23@test24@summary test Resource Bundle for bug 417748925@build Bug4177489_Resource Bug4177489_Resource_jf26@run main Bug4177489Test27@bug 417748928*/29/*30*31*32* (C) Copyright IBM Corp. 1999 - All Rights Reserved33*34* The original version of this source code and documentation is35* copyrighted and owned by IBM. These materials are provided36* under terms of a License Agreement between IBM and Sun.37* This technology is protected by multiple US and International38* patents. This notice and attribution to IBM may not be removed.39*40*/4142import java.util.*;43import java.io.*;4445public class Bug4177489Test extends RBTestFmwk {46public static void main(String[] args) throws Exception {47new Bug4177489Test().run(args);48}4950public void testIt() throws Exception {51ResourceBundle rb = ResourceBundle.getBundle( "Bug4177489_Resource" );52Locale l = rb.getLocale();53if (l.toString().length() > 0) {54errln("ResourceBundle didn't handle resource class name with '_' in it.");55}5657Locale loc = new Locale("jf", "");58ResourceBundle rb2 = ResourceBundle.getBundle( "Bug4177489_Resource", loc );59if (!loc.equals(rb2.getLocale())) {60errln("ResourceBundle didn't return proper locale name:"+rb2.getLocale());61}6263loc = new Locale("jf", "JF");64ResourceBundle rb3 = ResourceBundle.getBundle("Bug4177489_Resource", loc);65if (!loc.equals(rb3.getLocale())) {66errln("ResourceBundle didn't return proper locale name for property bundle:"+rb3.getLocale());67}68}69}707172