You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "LuciferYang (via GitHub)" <gi...@apache.org> on 2023/07/02 08:01:41 UTC

[GitHub] [spark] LuciferYang commented on a diff in pull request #41815: [SPARK-40731][DSTREAM] Make `streaming` pass on Java 21

LuciferYang commented on code in PR #41815:
URL: https://github.com/apache/spark/pull/41815#discussion_r1249336113


##########
streaming/src/test/scala/org/apache/spark/streaming/util/WriteAheadLogSuite.scala:
##########
@@ -476,7 +476,9 @@ class BatchedWriteAheadLogSuite extends CommonWriteAheadLogTests(
     val batchedWal = new BatchedWriteAheadLog(wal, sparkConf)
 
     val e = intercept[SparkException] {
-      val buffer = mock[ByteBuffer]
+      // SPARK-40731: Use a 0 size `ByteBuffer` instead of `mock[ByteBuffer]`
+      // due to mockito 4 can't mock/spy sealed class
+      val buffer = ByteBuffer.allocate(0)

Review Comment:
   or should we 
   
   ```
         val buffer = if (SystemUtils.isJavaVersionAtMost(JavaVersion.JAVA_17)) {
           mock[ByteBuffer]
         } else {
           ByteBuffer.allocate(0)
         }
   ```
   
   but this need add commons-lang3 as test dependency for `steaming` module
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org