mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-13372 Fixed some test issues on Java 9.
X-SVN-Rev: 40472
This commit is contained in:
parent
496df21bdf
commit
483d153217
2 changed files with 31 additions and 7 deletions
icu4j/main/tests
core/src/com/ibm/icu/dev/test/format
framework/src/com/ibm/icu/dev/test
|
@ -786,13 +786,23 @@ public class NumberFormatDataDrivenTest {
|
|||
"numberformattestspecification.txt", ICU58);
|
||||
}
|
||||
|
||||
// Note: This test case is really questionable. Depending on Java version,
|
||||
// something may or may not work. However the test data assumes a specific
|
||||
// Java runtime version. We should probably disable this test case - #13372
|
||||
@Test
|
||||
public void TestDataDrivenJDK() {
|
||||
// Android implements java.text.DecimalFormat with ICU4J (ticket #13322).
|
||||
if (TestUtil.getJavaVendor() == TestUtil.JavaVendor.Android) return;
|
||||
|
||||
DataDrivenNumberFormatTestUtility.runFormatSuiteIncludingKnownFailures(
|
||||
"numberformattestspecification.txt", JDK);
|
||||
if (TestUtil.getJavaVersion() == 8) {
|
||||
DataDrivenNumberFormatTestUtility.runFormatSuiteIncludingKnownFailures(
|
||||
"numberformattestspecification.txt", JDK);
|
||||
} else {
|
||||
// Oracle/OpenJDK 9's behavior is not exactly same with Oracle/OpenJDK 8.
|
||||
// Some test cases failed on 8 work well, while some other test cases
|
||||
// fail on 9, but worked on 8. Skip this test case if Java version is not 8.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -171,6 +171,7 @@ public final class TestUtil {
|
|||
lock.inc();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
synchronized (lock) {
|
||||
|
@ -235,11 +236,24 @@ public final class TestUtil {
|
|||
int ver = -1;
|
||||
String verstr = System.getProperty("java.version");
|
||||
if (verstr != null) {
|
||||
String[] numbers = verstr.split("\\.");
|
||||
try {
|
||||
ver = Integer.parseInt(numbers[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
ver = -1;
|
||||
String majorVerStr = null;
|
||||
if (verstr.startsWith("1.")) {
|
||||
String[] numbers = verstr.split("\\.");
|
||||
if (numbers.length > 1) {
|
||||
majorVerStr = numbers[1];
|
||||
}
|
||||
} else {
|
||||
String[] numbers = verstr.split("\\.|-");
|
||||
if (numbers.length > 0) {
|
||||
majorVerStr = numbers[0];
|
||||
}
|
||||
}
|
||||
if (majorVerStr != null) {
|
||||
try {
|
||||
ver = Integer.parseInt(majorVerStr);
|
||||
} catch (NumberFormatException e) {
|
||||
ver = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ver;
|
||||
|
|
Loading…
Add table
Reference in a new issue