Mocking Java InputStream

前端 未结 10 1698
既然无缘
既然无缘 2020-11-29 04:40

Please provide pointers to help me mock that java InputStream object. This is the line of code that I would wish to Mock:

InputStreamReader inputData = new I         


        
10条回答
  •  一个人的身影
    2020-11-29 05:04

    The best solution i found is use

    final InputStream inputStream1 = IOUtils.toInputStream("yourdata");
    

    and then wrap the inpustream in bufferedReader best way to write test around input Stream

提交回复
热议问题