@Test @PrepareForTest(OSSOutputStream.class) public void testFlush() throws Exception { PowerMockito.whenNew(BufferedOutputStream.class) .withArguments(Mockito.any(DigestOutputStream.class)).thenReturn(mLocalOutputStream); OSSOutputStream stream = new OSSOutputStream("testBucketName", "testKey", mOssClient, sConf .getList(PropertyKey.TMP_DIRS, ",")); stream.flush(); stream.close(); Mockito.verify(mLocalOutputStream).flush(); }
@Override public void flush() throws IOException { mLocalOutputStream.flush(); }
OSSOutputStream extends OutputStream { @Override public void flush() throws IOException { mLocalOutputStream.flush(); } }
OSSOutputStream extends OutputStream { @Override public void flush() throws IOException { mLocalOutputStream.flush(); } OSSOutputStream(String bucketName, String key, OSS client, List<String> tmpDirs); }
OSSOutputStream extends OutputStream { @Override public void flush() throws IOException { mLocalOutputStream.flush(); } OSSOutputStream(String bucketName, String key, OSS client, List<String> tmpDirs); @Override void write(int b); @Override void write(byte[] b); @Override void write(byte[] b, int off, int len); @Override void flush(); @Override void close(); }
OSSOutputStream extends OutputStream { @Override public void flush() throws IOException { mLocalOutputStream.flush(); } OSSOutputStream(String bucketName, String key, OSS client, List<String> tmpDirs); @Override void write(int b); @Override void write(byte[] b); @Override void write(byte[] b, int off, int len); @Override void flush(); @Override void close();  }