diff --git a/src/test/java/com/caucho/hessian/io/java17/base/SerializeCompatibleTest.java b/src/test/java/com/caucho/hessian/io/java17/base/SerializeCompatibleTest.java index 5f11a18..57b5212 100644 --- a/src/test/java/com/caucho/hessian/io/java17/base/SerializeCompatibleTest.java +++ b/src/test/java/com/caucho/hessian/io/java17/base/SerializeCompatibleTest.java @@ -65,9 +65,14 @@ public static void setUp() { * 'cause' is bound to lost here as getCause may return null */ @Test - public void test_case_1() throws IOException { + public void test_case_1() { if (isLessThanJdk17) { - test_JavaCurrencyWrapper(factory, originFactory); + try { + test_JavaCurrencyWrapper(factory, originFactory); + } catch (Exception e) { + e.printStackTrace(); + Assert.assertNull(e.getMessage(), e); + } } } @@ -77,9 +82,14 @@ public void test_case_1() throws IOException { * @throws IOException */ @Test - public void test_case_2() throws IOException { + public void test_case_2() { if (isLessThanJdk17) { - test_JavaCurrencyWrapper(originFactory, factory); + try { + test_JavaCurrencyWrapper(originFactory, factory); + } catch (Exception e) { + e.printStackTrace(); + Assert.assertNull(e.getMessage(), e); + } } } @@ -88,16 +98,26 @@ public void test_case_2() throws IOException { * @throws IOException */ @Test - public void test_case_3() throws IOException { + public void test_case_3() { if (isLessThanJdk17) { - test_JavaCurrencyDirectly(factory, originFactory); + try { + test_JavaCurrencyDirectly(factory, originFactory); + } catch (Exception e) { + e.printStackTrace(); + Assert.assertNull(e.getMessage(), e); + } } } @Test - public void test_case_4() throws IOException { + public void test_case_4() { if (isLessThanJdk17) { - test_JavaCurrencyDirectly(originFactory, factory); + try { + test_JavaCurrencyDirectly(originFactory, factory); + } catch (Exception e) { + e.printStackTrace(); + Assert.assertNull(e.getMessage(), e); + } } } @@ -106,9 +126,14 @@ public void test_case_4() throws IOException { * @throws IOException */ @Test - public void test_case_5() throws IOException { + public void test_case_5() { if (isLessThanJdk17()) { - test_JavaCurrencyWrapperList(factory, factory); + try { + test_JavaCurrencyWrapperList(factory, factory); + } catch (Exception e) { + e.printStackTrace(); + Assert.assertNull(e.getMessage(), e); + } } } @@ -117,16 +142,26 @@ public void test_case_5() throws IOException { * @throws IOException */ @Test - public void test_bytes_equals() throws IOException { + public void test_bytes_equals() { if (isLessThanJdk17()) { - test_Serialize(originFactory, factory); + try { + test_Serialize(originFactory, factory); + } catch (Exception e) { + e.printStackTrace(); + Assert.assertNull(e.getMessage(), e); + } } } @Test - public void test_decode_encode_jdk17() throws IOException { + public void test_decode_encode_jdk17() { if (!isLessThanJdk17()) { - test_JavaCurrencyWrapper(factory, factory); + try { + test_JavaCurrencyWrapper(factory, factory); + } catch (Exception e) { + e.printStackTrace(); + Assert.assertNull(e.getMessage(), e); + } } } @@ -151,7 +186,7 @@ private void test_JavaCurrencyWrapper(SerializerFactory serialize, SerializerFac throws IOException { if (isLessThanJdk17()) { CurrencyWrapper cw = new CurrencyWrapper(); - cw.setCurrency(Currency.getInstance(Locale.getDefault())); + cw.setCurrency(Currency.getInstance(Locale.SIMPLIFIED_CHINESE)); Object result = doEncodeNDecode(cw, serialize, deserialize); Assert.assertTrue(result instanceof CurrencyWrapper); @@ -163,7 +198,7 @@ private void test_JavaCurrencyWrapper(SerializerFactory serialize, SerializerFac private void test_JavaCurrencyDirectly(SerializerFactory serialize, SerializerFactory deserialize) throws IOException { if (isLessThanJdk17()) { - Currency origin = Currency.getInstance(Locale.getDefault()); + Currency origin = Currency.getInstance(Locale.SIMPLIFIED_CHINESE); Object result = doEncodeNDecode(origin, serialize, deserialize); Assert.assertTrue(result instanceof Currency); @@ -191,7 +226,7 @@ private void test_JavaCurrencyWrapperList(SerializerFactory serialize, Serialize private void test_Serialize(SerializerFactory originFactory, SerializerFactory newFactory) throws IOException { CurrencyWrapper cw = new CurrencyWrapper(); - cw.setCurrency(Currency.getInstance(Locale.getDefault())); + cw.setCurrency(Currency.getInstance(Locale.SIMPLIFIED_CHINESE)); byte[] resultOrigin = doSerialize(cw, originFactory); byte[] resultNew = doSerialize(cw, factory); diff --git a/src/test/java/com/caucho/hessian/io/java17/base/SerializeFactoryWithCurrency.java b/src/test/java/com/caucho/hessian/io/java17/base/SerializeFactoryWithCurrency.java index c6a40bf..26648f4 100644 --- a/src/test/java/com/caucho/hessian/io/java17/base/SerializeFactoryWithCurrency.java +++ b/src/test/java/com/caucho/hessian/io/java17/base/SerializeFactoryWithCurrency.java @@ -18,8 +18,6 @@ import com.caucho.hessian.io.Deserializer; import com.caucho.hessian.io.HessianProtocolException; -import com.caucho.hessian.io.JavaDeserializer; -import com.caucho.hessian.io.JavaSerializer; import com.caucho.hessian.io.Serializer; import com.caucho.hessian.io.SerializerFactory;