Build is success but failing in assessment

My build is getting success and test cases are also passing locally but failing in assessment. I checked unitTesting log andimage can see following errors.

But I can see there is no such typo mistake in file. Please help me where I am doing mistake.

hello @aditya899
why is your class name stockquoteService, it should be, did you happen to change the class name?


That problem solved but now I am getting the following error.
com.crio.warmup.stock.portfolio.PortfolioManagerTest > calculateExtrapolatedAnnualizedReturn() FAILED
java.lang.NullPointerException at

how can resolve this?

Hey! @aditya899

Assign String moduleToRun to “REFACTOR” instead of null. Thank me later :).

1 Like

Don’t why but after changing String moduleToRun to “REFACTOR” still it is not working.
I also changed in both the if conditions.

I am unable to solve the NullPointerException for the below two test cases.

com.crio.warmup.stock.portfolio.PortfolioManagerTest > calculateExtrapolatedAnnualizedReturn() FAILED
java.lang.NullPointerException at

com.crio.warmup.stock.portfolio.PortfolioManagerTest > calculateAnnualizedReturnNoDataOnEndDate() FAILED
java.lang.NullPointerException at

please help to solve this.

hello @aditya899
before module 6 there was only 1 api i.e. tiingo so we were using stockquote which is present in but since you are initialsing postfoliomanagerimpl object with respect to Stockquoteservice now, which is either tiingo or alphavantage.
So when you get the object of stovkquote from factory, it is linked to one of two implementations. So you have to be sure which api’s getstockquote you are using.

Hint: getstockquote is defined in both and , which one you are using, does your application calling the respective getstockquote method or not .

HI Aditya,
As @Anmol-Crio_TA mentioned, we have two APIs to take care of rather than one as in Mod4. In your PortolioManagerImpl:calculateAnnualizedReturn() method, are you using the getStockQuote method provided by the StockQuoteService object or are you using an implementation of your own? Which one would work for both Tiingo & Alphavantage API?

Also, kindly change this line in PortfolioManagerTest

moduleToRun = "REFACTOR";



Closing this topic as your issue is resolved by the mentor. If it is still not resolved, Kindly un-mark the accepted solution or create a new topic and post this question as a reference link in the description of the new topic.