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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]