You have to sort in reverse order. You missed a TODO!
verify your logic and check if sorting is happening properly.
In case the second argument is not passed. You have to get the latest date available from the api response. And use that as the endDate.
You can check how you handled the case of endDate earlier than purchaseDate.
You can check how you are comparing annualizedReturns for sorting.
To answer you question first, no its not related to SpotBugs. Had that been the case, you build itself would have failed, as well as the static quality assessment that is carried out before running the test cases.
You might be facing this error because the case where the data for end date is not available might not have been properly covered, or the list might not have been sorted correctly. I don’t think you are hardcoding something, since the cases which test for that in my opinion have passed, but in case you are, please correct that as well. Also, last thing, make sure the formula is right. There are a lot of posts in forum that cover that.
Let me know if this issue persists!
Its a violation of community guidelines to share code, so I’ll advise you to remove that.
It’ll be also wrong on my part to comment on it. I hope you understand
what i did is that i have taken the difference of closing price of TingloCandle array and open price of starting index of TingloCandle array. then divide the difference with open of starting index.
Is this correct?
Watch for the following reasons in such scenarios:
- Make sure you are not doing hardcode.
- Don’t make any changes to a test file.
Yes, that’s the right way to go about it.
I think you might have changed annualizedReturn function/variable name in testfile as well in dto class to avoid PMD violations which is wrong.
i haven’t change anything. i updated my code when args is null to todays date but it shows me fail again
when args is not present then choose the end date for which data is available. Check weather data is available for today or yesterdayor previous date.
I am converting double to int in compare function in comparator class which is wrong.