请提供指针来帮助我模拟那个 java InputStream 对象.这是我希望模拟的代码行:
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 InputStreamReader(System.in);
bufferdReader = new BufferedReader(inputData);
bufferdReader.readLine();
BufferedReader bufferedReader = org.mockito.Mockito.mock(BufferedReader.class);
when(bufferedReader.readLine())
.thenReturn("first line")
.thenReturn("second line");
org.junit.Assert.when(new Client(bufferedReader).parseLine())
.thenEquals(IsEqual.equalTo("first line"));
这篇关于模拟 Java InputStream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!