Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
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?