@@ -27,14 +27,15 @@ import org.mockito.Matchers.{any, eq => meq}
27
27
import org .mockito .Mockito ._
28
28
import org .mockito .invocation .InvocationOnMock
29
29
import org .mockito .stubbing .Answer
30
+ import org .scalatest .PrivateMethodTester
30
31
31
32
import org .apache .spark .{SparkFunSuite , TaskContextImpl }
32
33
import org .apache .spark .network ._
33
34
import org .apache .spark .network .buffer .ManagedBuffer
34
35
import org .apache .spark .network .shuffle .BlockFetchingListener
35
36
36
37
37
- class ShuffleBlockFetcherIteratorSuite extends SparkFunSuite {
38
+ class ShuffleBlockFetcherIteratorSuite extends SparkFunSuite with PrivateMethodTester {
38
39
// Some of the tests are quite tricky because we are testing the cleanup behavior
39
40
// in the presence of faults.
40
41
@@ -113,13 +114,15 @@ class ShuffleBlockFetcherIteratorSuite extends SparkFunSuite {
113
114
// Note: ShuffleBlockFetcherIterator wraps input streams in a BufferReleasingInputStream
114
115
val wrappedInputStream = inputStream.get.asInstanceOf [BufferReleasingInputStream ]
115
116
verify(mockBuf, times(0 )).release()
116
- verify(wrappedInputStream.delegate, times(0 )).close()
117
+ val delegateAccess = PrivateMethod [InputStream ](' delegate )
118
+
119
+ verify(wrappedInputStream.invokePrivate(delegateAccess()), times(0 )).close()
117
120
wrappedInputStream.close()
118
121
verify(mockBuf, times(1 )).release()
119
- verify(wrappedInputStream.delegate , times(1 )).close()
122
+ verify(wrappedInputStream.invokePrivate(delegateAccess()) , times(1 )).close()
120
123
wrappedInputStream.close() // close should be idempotent
121
124
verify(mockBuf, times(1 )).release()
122
- verify(wrappedInputStream.delegate , times(1 )).close()
125
+ verify(wrappedInputStream.invokePrivate(delegateAccess()) , times(1 )).close()
123
126
}
124
127
125
128
// 3 local blocks, and 2 remote blocks
0 commit comments