8312416: Tests in Locale should have more descriptive names

Reviewed-by: lancea, naoto
This commit is contained in:
Justin Lu 2023-07-28 16:27:06 +00:00
parent d9559f9b24
commit a9a3463afb
15 changed files with 60 additions and 105 deletions

View File

@ -26,7 +26,7 @@
* @bug 8179071 8202537 8231273 8251317
* @summary Test that language aliases of CLDR supplemental metadata are handled correctly.
* @modules jdk.localedata
* @run junit/othervm -Djava.locale.providers=CLDR Bug8179071
* @run junit/othervm -Djava.locale.providers=CLDR AliasesShouldBeRecognizedInCLDR
*/
/*
@ -49,7 +49,7 @@ import org.junit.jupiter.params.provider.MethodSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class Bug8179071 {
public class AliasesShouldBeRecognizedInCLDR {
/*
* Deprecated and Legacy tags.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,14 +24,18 @@
* @test
* @bug 4518797
* @summary Make sure that hashCode() and read/writeObject() are thread-safe.
* @run main Bug4518797 10
* @run main HashCodeShouldBeThreadSafe 10
*/
import java.util.*;
import java.io.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Locale;
// Usage: java Bug4518797 [duration]
public class Bug4518797 {
// Usage: java HashCodeShouldBeThreadSafe [duration]
public class HashCodeShouldBeThreadSafe {
static volatile boolean runrun = true;
static volatile String message = null;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,10 +22,10 @@
*/
/*
@test
@bug 4184873
@summary test that locale invariants are preserved across serialization
@library /java/text/testlib
@run main Bug4184873Test
@bug 4184873
@run main LegacyCodesClassInvariant
*/
/*
* This file is available under and governed by the GNU General Public
@ -61,18 +61,22 @@
* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
*/
import java.util.*;
import java.io.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Locale;
/**
* A Locale can never contain the following language codes: he, yi or id.
*/
public class Bug4184873Test extends IntlTest {
public class LegacyCodesClassInvariant extends IntlTest {
public static void main(String[] args) throws Exception {
if (args.length == 1 && args[0].equals("prepTest")) {
prepTest();
} else {
new Bug4184873Test().run(args);
new LegacyCodesClassInvariant().run(args);
}
}
@ -104,7 +108,7 @@ public class Bug4184873Test extends IntlTest {
private ObjectInputStream getStream(String lang) {
try {
final File f = new File(System.getProperty("test.src", "."), "Bug4184873_"+lang);
final File f = new File(System.getProperty("test.src", "."), "LegacyCodesClassInvariant_"+lang);
return new ObjectInputStream(new FileInputStream(f));
} catch (Exception e) {
errln(e.toString());
@ -125,7 +129,7 @@ public class Bug4184873Test extends IntlTest {
private static void outputLocale(String lang) {
try {
ObjectOutputStream out = new ObjectOutputStream(
new FileOutputStream("Bug4184873_"+lang));
new FileOutputStream("LegacyCodesClassInvariant_"+lang));
out.writeObject(Locale.of(lang, "XX"));
out.close();
} catch (Exception e) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,11 +25,19 @@
* @test
* @bug 7069824 8042360 8032842 8175539 8210443 8242010 8276302
* @summary Verify implementation for Locale matching.
* @run testng/othervm Bug7069824
* @run testng/othervm LocaleMatchingTest
*/
import java.util.*;
import java.util.Locale.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Locale.FilteringMode;
import java.util.Locale.LanguageRange;
import java.util.Map;
import static java.util.Locale.FilteringMode.*;
import static java.util.Locale.LanguageRange.*;
import static org.testng.Assert.*;
@ -37,7 +45,7 @@ import static org.testng.Assert.*;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class Bug7069824 {
public class LocaleMatchingTest {
@DataProvider(name = "LRConstructorData")
Object[][] LRConstructorData() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,24 +26,24 @@
* @summary Verify that the default locale can be specified from the
* command line.
* @run main/othervm -Duser.language=de -Duser.country=DE -Duser.variant=EURO
* Bug4152725 de_DE_EURO
* LocaleShouldSetFromCLI de_DE_EURO
* @run main/othervm -Duser.language=ja -Duser.country= -Duser.variant=
* Bug4152725 ja
* LocaleShouldSetFromCLI ja
* @run main/othervm -Duser.language=en -Duser.country=SG -Duser.variant=
* Bug4152725 en_SG
* LocaleShouldSetFromCLI en_SG
* @run main/othervm -Duser.language= -Duser.country=DE -Duser.variant=EURO
* Bug4152725 _DE_EURO
* LocaleShouldSetFromCLI _DE_EURO
* @run main/othervm -Duser.language=ja -Duser.country= -Duser.variant=YOMI
* Bug4152725 ja__YOMI
* LocaleShouldSetFromCLI ja__YOMI
* @run main/othervm -Duser.language= -Duser.country= -Duser.variant=EURO
* Bug4152725 __EURO
* LocaleShouldSetFromCLI __EURO
* @run main/othervm -Duser.language=de -Duser.region=DE_EURO
* Bug4152725 de_DE_EURO
* LocaleShouldSetFromCLI de_DE_EURO
*/
import java.util.Locale;
public class Bug4152725 {
public class LocaleShouldSetFromCLI {
public static void main(String[] args) {

View File

@ -26,7 +26,7 @@
* @bug 8135061
* @summary Checks that the Locale.lookup executes properly without throwing
* any exception for some specific language ranges
* @run junit Bug8135061
* @run junit LookupOnValidRangeTest
*/
import java.util.Collection;
@ -40,7 +40,7 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
public class Bug8135061 {
public class LookupOnValidRangeTest {
/**
* Lookup should run without throwing any exception and return null as

View File

@ -25,7 +25,7 @@
* @bug 8035133
* @summary Checks that the tags matching the range with quality weight q=0
* e.g. en;q=0 must be elimited and must not be the part of output
* @run junit Bug8035133
* @run junit MatchEmptyWeightCorrectly
*/
import java.util.ArrayList;
@ -40,7 +40,7 @@ import org.junit.jupiter.params.provider.MethodSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Bug8035133 {
public class MatchEmptyWeightCorrectly {
// Ensure weights with 'q=0' work as expected during lookup
@ParameterizedTest

View File

@ -27,8 +27,8 @@
* @summary Verify ConcurrentModificationException is not thrown with multiple
* thread accesses.
* @modules java.base/sun.util.locale.provider
* @compile -XDignore.symbol.file=true Bug6989440.java
* @run junit Bug6989440
* @compile -XDignore.symbol.file=true ProviderPoolMultiThreadAccess.java
* @run junit ProviderPoolMultiThreadAccess
*/
import java.text.spi.DateFormatProvider;
import java.util.spi.LocaleNameProvider;
@ -39,7 +39,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
import org.junit.jupiter.api.Test;
public class Bug6989440 {
public class ProviderPoolMultiThreadAccess {
static volatile boolean failed; // false
static final int THREADS = 50;

View File

@ -23,12 +23,12 @@
/*
* @test
* @bug 8166884
* @bug 8166994
* @summary Checks the subsequent call to parse the same language ranges
* which must generate the same list of language ranges
* i.e. the priority list containing equivalents, as in the
* first call
* @run junit Bug8166994
* @run junit SubsequentRangeParsingTest
*/
import java.util.Arrays;
@ -43,7 +43,7 @@ import org.junit.jupiter.params.provider.MethodSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Bug8166994 {
public class SubsequentRangeParsingTest {
/*
* Checks that consecutive calls to parse the same language ranges

View File

@ -31,8 +31,8 @@
* e.g. "HI-Deva".toLowerCase() in the Turkish locale returns
* "hı-deva", where 'ı' is the LATIN SMALL LETTER DOTLESS I character
* which is not allowed in the language ranges/tags.
* @compile -encoding utf-8 Bug8159420.java
* @run junit/othervm -Duser.language=tr -Duser.country=TR Bug8159420
* @compile -encoding utf-8 TurkishLangRangeTest.java
* @run junit/othervm -Duser.language=tr -Duser.country=TR TurkishLangRangeTest
*/
import java.util.ArrayList;
@ -58,7 +58,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class Bug8159420 {
public class TurkishLangRangeTest {
/*
* Ensure parse() does not throw IllegalArgumentException for the Turkish Locale

View File

@ -1 +0,0 @@
<APPLET CODE="bug4123285.class" CODEBASE="./" WIDTH="250" HEIGHT="325" ALIGN="TOP"></APPLET>

View File

@ -1,60 +0,0 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.util.Locale;
public class bug4123285 extends java.applet.Applet {
public void start() {
System.out.println("Hello, world!");
Locale[] systemLocales = null;
try {
System.out.println("Default locale = " + Locale.getDefault());
systemLocales = Locale.getAvailableLocales();
System.out.println("Found " + systemLocales.length + " locales:");
Locale[] locales = new Locale[systemLocales.length];
for (int i = 0; i < locales.length; i++) {
Locale lowest = null;
for (int j = 0; j < systemLocales.length; j++) {
if (i > 0 && locales[i - 1].toString().compareTo(systemLocales[j].toString()) >= 0)
continue;
if (lowest == null || systemLocales[j].toString().compareTo(lowest.toString()) < 0)
lowest = systemLocales[j];
}
locales[i] = lowest;
}
for (int i = 0; i < locales.length; i++) {
if (locales[i].getCountry().length() == 0)
System.out.println(" " + locales[i].getDisplayLanguage() + ":");
else {
if (locales[i].getVariant().length() == 0)
System.out.println(" " + locales[i].getDisplayCountry());
else
System.out.println(" " + locales[i].getDisplayCountry() + ", "
+ locales[i].getDisplayVariant());
}
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}