From e232ae2e62b63b939db921067685c7cb1bed9317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=8A?= =?UTF-8?q?=D1=80=20=D0=9A=D1=83=D1=80=D1=82=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Fri, 25 Oct 2024 12:40:47 +0300 Subject: [PATCH] Remove long time not needed ICU4J references in tests These are not referenced at all thus simply deleted. --- .../NumberToStringConverterTest.java | 11 ----- .../StringToNumberConverterTest.java | 11 ----- .../StringToNumberParserTestHarness.java | 45 +------------------ 3 files changed, 1 insertion(+), 66 deletions(-) diff --git a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/NumberToStringConverterTest.java b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/NumberToStringConverterTest.java index 051b9ac427b..9eca1416736 100644 --- a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/NumberToStringConverterTest.java +++ b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/NumberToStringConverterTest.java @@ -17,7 +17,6 @@ import static org.junit.Assert.assertEquals; -import java.lang.reflect.Constructor; import java.math.BigDecimal; import java.math.BigInteger; import java.text.Format; @@ -127,16 +126,6 @@ public void testConvertBigIntegerToString() throws Exception { assertEquals(expected, result); } - Class icuBigDecimal = null; - Constructor icuBigDecimalCtr = null; - { - try { - icuBigDecimal = Class.forName("com.ibm.icu.math.BigDecimal"); - icuBigDecimalCtr = icuBigDecimal.getConstructor(BigInteger.class, int.class); - } - catch(ClassNotFoundException | NoSuchMethodException e) {} - } - @Test public void testConvertBigDecimalToString() throws Exception { NumberToStringConverter converter = NumberToStringConverter.fromBigDecimal(); diff --git a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/StringToNumberConverterTest.java b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/StringToNumberConverterTest.java index efe2020a749..8ebd2d826ab 100644 --- a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/StringToNumberConverterTest.java +++ b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/databinding/conversion/StringToNumberConverterTest.java @@ -19,7 +19,6 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThrows; -import java.lang.reflect.Constructor; import java.math.BigDecimal; import java.math.BigInteger; import java.text.Format; @@ -83,16 +82,6 @@ public void testConvertsToBigInteger() throws Exception { assertEquals(input, result); } - Class icuBigDecimal = null; - Constructor icuBigDecimalCtr = null; - { - try { - icuBigDecimal = Class.forName("com.ibm.icu.math.BigDecimal"); - icuBigDecimalCtr = icuBigDecimal.getConstructor(BigInteger.class, int.class); - } - catch(ClassNotFoundException | NoSuchMethodException e) {} - } - @Test public void testConvertsToBigDecimal() throws Exception { StringToNumberConverter converter = StringToNumberConverter.toBigDecimal(numberFormat); diff --git a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/internal/databinding/conversion/StringToNumberParserTestHarness.java b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/internal/databinding/conversion/StringToNumberParserTestHarness.java index 2875ec2ec10..55dd6017ef3 100644 --- a/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/internal/databinding/conversion/StringToNumberParserTestHarness.java +++ b/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/internal/databinding/conversion/StringToNumberParserTestHarness.java @@ -14,7 +14,6 @@ package org.eclipse.core.tests.internal.databinding.conversion; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -152,49 +151,7 @@ public void testRanges() throws Exception { assertFalse("invalid BigDecimal min", assertValid(bigDecimalMin)); assertFalse("invalid BigDecimal max", assertValid(bigDecimalMax)); - /** - * The ICU4J plugin's NumberFormat will return it's own BigDecimal - * implementation, com.ibm.icu.math.BigDecimal. The issue this causes is - * that we can't reference this class as it's not part of the - * replacement plugin. So in order to ensure that we handle Number's - * that are not part of the JDK stub a number implemenation and ensure - * that the double representation of this number is used. - */ - class MyNumber extends Number { - double value; - int count; - - MyNumber(double value) { - this.value = value; - } - - private static final long serialVersionUID = 1L; - - @Override - public double doubleValue() { - count++; - return value; - } - - @Override - public float floatValue() { - return 0; - } - - @Override - public int intValue() { - return 0; - } - - @Override - public long longValue() { - return 0; - } - } - - MyNumber number = new MyNumber(1); - assertEquals(0, number.count); + Number number = BigDecimal.valueOf((double) 1); assertTrue(StringToNumberParser.inIntegerRange(number)); - assertTrue("double value retrieved", number.count > 0); } }