Problem unit test mainReadQuotesEdgeCase()

I do not understand how can i get passed mainReadQuotesEdgeCase() as to be successful i need to put objectmapper in try catch block so that when it throws exception on empty json file i can catch it but if i put try catch block then spotbug generates warning as while running other testcases it is not used. Any idea on how can i approach this??

you can use if else approach

how can i use if else to check for exception @visargdesai

Take a look at this link. And fit if else condition on basis of empty list .

do you mean that i make if else on the basis of file name?? @visargdesai

No. I mean after you retrieve data into a list or array, check if the list is empty or not. if not, then simply go wiih the flow else throw exception.

i am using object mapper to read the data and store it in array of pojo . So, when empty json is given it throws exception. So, do you mean that i should make if else statement before calling objectMapper and check if it is empty or not. @visargdesai

thanks. Finally got it

Close the topic. Happy coding!!

how to close the topic

It is closed. Close the topic means mark it as solved.