Mocking Java InputStream

前端 未结 10 1681
既然无缘
既然无缘 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 04:45

    You could use commons-io to create some stub input streams:

    InputStream stubInputStream = 
         IOUtils.toInputStream("some test data for my input stream", "UTF-8");
    

提交回复
热议问题