私が書き込むバイトOutputStream(ファイル OutputStream) が同じから読み取ったものと同じであることをテストしたいと思いますInputStream。
テストは次のようになります
@Test
public void testStreamBytes() throws PersistenceException, IOException, ClassNotFoundException {
String uniqueId = "TestString";
final OutputStream outStream = fileService.getOutputStream(uniqueId);
new ObjectOutputStream(outStream).write(uniqueId.getBytes());
final InputStream inStream = fileService.getInputStream(uniqueId);
}
InputStreamないことに気がつきましたgetBytes()。
どうすれば次のようなものをテストできますか
assertEquals(inStream.getBytes(), uniqueId.getBytes())
ありがとうございました