Expand my Community achievements bar.

SOLVED

JUnit for BufferedReader

Avatar

Level 6

new BufferedReader(new InputStreamReader(<inputStremObject>, StandardCharsets.UTF_8))

I have mocked InputStream, InputStreamReader and BufferedReader and I'm fetching a JSON file asset. <bufferedReaderObject>.readLine() throws IOException (error msg: Underlying input stream returned zero bytes) in my test file. How do I handle this JUnit scenario?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Can you please share the complete test case?

 

View solution in original post

3 Replies

Avatar

Correct answer by
Employee Advisor

Can you please share the complete test case?