You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/04/29 15:58:16 UTC
[GitHub] [spark] xkrogen commented on a change in pull request #32389: [SPARK-35263] [TEST] Refactor ShuffleBlockFetcherIteratorSuite to reduce duplicated code
xkrogen commented on a change in pull request #32389:
URL: https://github.com/apache/spark/pull/32389#discussion_r623186492
##########
File path: core/src/test/scala/org/apache/spark/storage/ShuffleBlockFetcherIteratorSuite.scala
##########
@@ -1061,3 +857,73 @@ class ShuffleBlockFetcherIteratorSuite extends SparkFunSuite with PrivateMethodT
assert(mergedBlock.size === inputBlocks.map(_.size).sum)
}
}
+
+object ShuffleBlockFetcherIteratorSuite {
Review comment:
Sure, I guess there is no strong reason. They can be static / located in the object but it's just a test so it doesn't matter much either way.
##########
File path: core/src/test/scala/org/apache/spark/storage/ShuffleBlockFetcherIteratorSuite.scala
##########
@@ -1061,3 +857,73 @@ class ShuffleBlockFetcherIteratorSuite extends SparkFunSuite with PrivateMethodT
assert(mergedBlock.size === inputBlocks.map(_.size).sum)
}
}
+
+object ShuffleBlockFetcherIteratorSuite {
+
+ private def doReturn(value: Any) = org.mockito.Mockito.doReturn(value, Seq.empty: _*)
+
+ private def answerFetchBlocks(transfer: BlockTransferService)(answer: Answer[Unit]): Unit =
+ when(transfer.fetchBlocks(any(), any(), any(), any(), any(), any())).thenAnswer(answer)
+
+ private def verifyFetchBlocksCount(transfer: BlockTransferService, expectedCount: Int): Unit =
Review comment:
Yes, good call.
--
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.
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