This is an automated email from the ASF dual-hosted git repository.

panyuepeng pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git


The following commit(s) were added to refs/heads/dev by this push:
     new 553376728 [ISSUES-3063][Improve] Improve ImplicitsUtilsTest test code 
coverage (#3558)
553376728 is described below

commit 553376728a67a735c15dd4988bbe4de71d6841a9
Author: Cancai Cai <[email protected]>
AuthorDate: Tue Feb 20 10:24:20 2024 +0800

    [ISSUES-3063][Improve] Improve ImplicitsUtilsTest test code coverage (#3558)
---
 .../apache/streampark/common/util/ImplicitsUtilsTest.scala   | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/streampark-common/src/test/scala/org/apache/streampark/common/util/ImplicitsUtilsTest.scala
 
b/streampark-common/src/test/scala/org/apache/streampark/common/util/ImplicitsUtilsTest.scala
index 04a22d941..7b77e927c 100644
--- 
a/streampark-common/src/test/scala/org/apache/streampark/common/util/ImplicitsUtilsTest.scala
+++ 
b/streampark-common/src/test/scala/org/apache/streampark/common/util/ImplicitsUtilsTest.scala
@@ -41,19 +41,29 @@ class ImplicitsUtilsTest extends AnyFunSuite {
   }
 
   test("StringImplicits.cast should convert string to the specified type") {
+    val byteString = "1"
     val intString = "123"
     val doubleString = "3.14"
+    val floatString = "3.14f"
     val booleanString = "true"
+    val shortString = "12345"
+    val longString = "100000000"
 
+    assert(booleanString.cast[Boolean](classOf[Boolean]))
+    assert(byteString.cast[Byte](classOf[Byte]) == 1)
     assert(intString.cast[Int](classOf[Int]) == 123)
     assert(doubleString.cast[Double](classOf[Double]) == 3.14)
-    assert(booleanString.cast[Boolean](classOf[Boolean]))
+    assert(floatString.cast[Float](classOf[Float]) == 3.14f)
+    assert(shortString.cast[Short](classOf[Short]) == 12345)
+    assert(longString.cast[Long](classOf[Long]) == 100000000)
   }
 
   test("StringImplicits.cast should throw IllegalArgumentException for 
unsupported type") {
     val unsupportedString = "test"
+    val unsupportedBigdeciaml = "10e5"
     assertThrows[IllegalArgumentException] {
       unsupportedString.cast[Unit](classOf[Unit])
+      unsupportedBigdeciaml.cast[BigDecimal](classOf[BigDecimal])
     }
   }
 }

Reply via email to