Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/text/resources/Format/Bug4442855.java
38855 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*/2223/*24*@test25*@bug 444285526*@summary verify the era's translation for tradition chinese27*/2829import java.io.*;30import java.util.*;31import java.text.*;3233public class Bug444285534{35public static void main(String[] argv){36int result = 0;37Bug4442855 testsuite = new Bug4442855();3839if( !testsuite.TestAD()) result ++;40if( !testsuite.TestBC()) result ++;41if( result > 0 ) throw new RuntimeException();4243}4445private boolean TestAD(){46Locale zhTWloc = new Locale("zh", "TW");47SimpleDateFormat sdf = new SimpleDateFormat("G", zhTWloc);4849return Test(sdf.format(new Date()), "\u897f\u5143", "AD");50}5152private boolean TestBC(){53Locale zhTWloc = new Locale("zh", "TW");54SimpleDateFormat sdf = new SimpleDateFormat("G", zhTWloc);5556Calendar cdar = sdf.getCalendar();57cdar.set(-2000, 1, 1);58return Test(sdf.format(cdar.getTime()), "\u897f\u5143\u524d", "BC");59}6061private boolean Test(String parent, String child, String info){62boolean retval = true;6364if(!parent.equals(child)){65System.out.println("Error translation for " + info + " in TCH: " + parent);66System.out.println("Which should be: " + child );67retval = false;68}6970return retval;71}72}737475