Expand my Community achievements bar.

Nomination window for the Adobe Community Advisor Program, Class of 2025, is now open!
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

Community Advisor

Avatar

Community Advisor

Avatar

Correct answer by
Employee Advisor

Can you please share the complete test case?