mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-21 12:40:02 +00:00
ICU-11474 Identify Android as a Java vendor in unit tests.
R=markus.icu@gmail.com Review URL: https://codereview.appspot.com/189550043 X-SVN-Rev: 36961
This commit is contained in:
parent
22c8c94d14
commit
6572a72c63
3 changed files with 14 additions and 10 deletions
|
@ -1,13 +1,15 @@
|
|||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2000-2010, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
* Copyright (C) 2000-2015, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.dev.test.timezone;
|
||||
import java.util.Date;
|
||||
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.dev.test.TestUtil;
|
||||
import com.ibm.icu.dev.test.TestUtil.JavaVendor;
|
||||
import com.ibm.icu.text.DateFormat;
|
||||
import com.ibm.icu.util.Calendar;
|
||||
import com.ibm.icu.util.SimpleTimeZone;
|
||||
|
@ -438,9 +440,7 @@ public class TimeZoneBoundaryTest extends TestFmwk
|
|||
// support historic transitions, therefore, the test below
|
||||
// will fail on such environment (with the latest TimeZone
|
||||
// patch for US 2007+ rule).
|
||||
String javaver = System.getProperty("java.version", "1.3");
|
||||
if (!javaver.startsWith("1.3"))
|
||||
{
|
||||
if (TestUtil.getJavaVendor() == JavaVendor.Android || TestUtil.getJavaVersion() > 3) {
|
||||
// This only works in PST/PDT
|
||||
TimeZone.setDefault(safeGetTimeZone("PST"));
|
||||
logln("========================================");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2002-2014, International Business Machines
|
||||
* Copyright (c) 2002-2015, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Author: Alan Liu
|
||||
|
@ -20,6 +20,7 @@ import java.util.Set;
|
|||
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.dev.test.TestUtil;
|
||||
import com.ibm.icu.dev.test.TestUtil.JavaVendor;
|
||||
import com.ibm.icu.impl.CurrencyData;
|
||||
import com.ibm.icu.text.CurrencyDisplayNames;
|
||||
import com.ibm.icu.text.CurrencyMetaInfo;
|
||||
|
@ -575,7 +576,7 @@ public class CurrencyTest extends TestFmwk {
|
|||
|
||||
// With Java Locale
|
||||
// Note: skip this test on Java 6 or older when keywords are available
|
||||
if (locale.getKeywords() == null || TestUtil.getJavaVersion() >= 7) {
|
||||
if (locale.getKeywords() == null || TestUtil.getJavaVendor() == JavaVendor.Android || TestUtil.getJavaVersion() >= 7) {
|
||||
Locale javaloc = locale.toLocale();
|
||||
String[] actualWithJavaLocale = Currency.getAvailableCurrencyCodes(javaloc, date);
|
||||
// should be exactly same with the ULocale version
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
* Copyright (C) 2001-2015, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.dev.test;
|
||||
|
@ -212,7 +212,8 @@ public final class TestUtil {
|
|||
public enum JavaVendor {
|
||||
Unknown,
|
||||
Oracle,
|
||||
IBM
|
||||
IBM,
|
||||
Android
|
||||
}
|
||||
|
||||
public static JavaVendor getJavaVendor() {
|
||||
|
@ -222,6 +223,8 @@ public final class TestUtil {
|
|||
vendor = JavaVendor.IBM;
|
||||
} else if (javaVendorProp.startsWith("sun") || javaVendorProp.startsWith("oracle")) {
|
||||
vendor = JavaVendor.Oracle;
|
||||
} else if (javaVendorProp.contains("android")) {
|
||||
vendor = JavaVendor.Android;
|
||||
}
|
||||
return vendor;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue