我是这样绑的:
byte[] mockByteArray = PowerMock.createMockAndExpectNew(byte[].class, 10);
但是我遇到了运行时异常:找不到对象方法!如何解决?
[编辑] 我想模拟一个RandomAccessFile.read(byte[] buffer)
:
byte[] fileCutter(RandomAccessFile randomAccessFile, long position, int filePartSize) throws IOException{
byte[] buffer = new byte[filePartSize];
randomAccessFile.seek(position);
randomAccessFile.read(buffer);
return buffer;
}