NoDataOnEndDate test failed

I am getting NoDataOnEndDate test failed and AnnualizedReturn test failed. The former is not present in the test suite provided where as the latter I have tested with the test cases provided and is running fine.
As the name suggests I tried throwing an error if there is no data available on the last date however then also I am getting error. Any ideas on what to do ?
In addition the log files also don’t contain anything just that the build was unsucessful.

Wow, that was a really helpful suggestion…

1 Like

Logical errors as in ? I mean I know there must be some therefore error is coming but what is noDataOnEnd

In case of no data on end date, you need to use the data on last available date after which no data is available. I guess you are extracting data from API return by checking against dates, which is why it might be failing since there might not be data for a particular date.

Let me know it it helps you!

If it was returning desired values, there wouldn’t be any error obviously.

I have already tried this but it still doesn’t help

This is some terrific insight.

I found the solution.
Fir make sure the Mockito error which pops up in the Test file is not coming. Don’t use Mockito.lenient() for removing it rather implement getStockQuote in order to remove it. Second make use of the fact that if there is no data received for the last date then use the last data date as the last date.
This helped me remove the error.

What should i return if the there is no data between startDate and endDate ?