Skip to content

Instantly share code, notes, and snippets.

@suryasaini96
Last active July 26, 2021 06:18
Show Gist options
  • Save suryasaini96/4d83b961544a78c59f0d6c62a67a6792 to your computer and use it in GitHub Desktop.
Save suryasaini96/4d83b961544a78c59f0d6c62a67a6792 to your computer and use it in GitHub Desktop.
QMoney Module 4 Issues Identified

QMoney Module 4 Issues

Alright folks, finally I got my code to work. Here are the issues in QMoney Module 4 that I've identified. I suggest @Team Crio @Crio Assist to please re-visit this module to fix them. Will save a lot of time in future for other people 🙂 :-

  1. The cloned code stub has missing implementations

    • In PortfolioManagerApplication.java there's a method called readFileAsString() used whose implementation is missing (although this function serves no use later). Similarly, there's a getStockQuote() method in PortfolioManagerImpl.java which is also missing. If these are the TODOs then what we're supposed to implement in them is missing (had to copy them from intro video). The TODO comments within the files are also not clear. If possible they should be added in milestones only. These two methods were newly introduced in this module only. There's also a constructor used for initializing this class with RestTemplate but the variable is missing. So we also need to add this line at the start RestTemplate restTemplate;
  2. The test cases have problems :-

    • In PortfolioManagerTest.java they use Mockito for getStockQuote() method based on String moduleToRun = null; It gives two errors: a) If used as it is then NullPointerException. b) If changed to moduleToRun = "REFACTOR"; then UnneccesaryStubbingException. The solution is to change it to "REFACTOR" and mandatorily use getStockQuote() method in calculateAnnualizedReturn() method. From the signature you can see that the getStockQuote() method returns a list of quotes for a symbol.
    • Another test case fails because there's also a case when no endDate is provided to buildUri() method. There could be no end date passed should be mentioned in the module instructions only so this test doesn't fail. It could be easily implemented because the API call doesn't mandatorily needs the end date.
    • The list of annualized returns needs to be sorted before returning is also not mentioned.
  3. In PortfolioManagerApplication.java for mainCalculateReturnsAfterRefactor() method it uses a portfolioManager object for returning and needs implementation. It confuses with PortfolioManager class. Again figured this out using method signature and what was probably expected.

All in all this module needs a lot of changes in sync with what we have done previously and needs proper explanation and correct code stubs. If there wasn't this life-saver FAQ that one of the TA sent one couldn't have probably figured out what was going on.

I hope it makes sense. 🙂

Author

Surya Saini 👨‍💻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment