Failed 2 test case StockquoteServicefactory


passed tingoservicetes and alphavantageservicetest
@anand-crio
@Shashank_Crio_TA
@Kush_Crio_TA

Hey,
You have to basically implement two things one is alphavantage and other is tingo. So we have to follow the factory pattern. You need to add like -
If (tingoservice){
//use tingo
}
else{
//use alphavantage
}
One test case says uppercase i.e your code should handle both things - tingo or Tingo


i implemented like this but shows me failed 2 test cases.
I think the problem is in Portfoliomanagerfactory?

@ankit19 Hey… I see that currently you are facing issues with


com.crio.warmup.stock.portfolio.PortfolioManagerTest > calculateExtrapolatedAnnualizedReturn() FAILED
java.lang.IllegalArgumentException at PortfolioManagerTest.java:117

com.crio.warmup.stock.quotes.StockQuoteServiceFactoryTest > getServiceTiingoUpperCase() FAILED
org.opentest4j.AssertionFailedError at StockQuoteServiceFactoryTest.java:19

com.crio.warmup.stock.quotes.StockQuoteServiceFactoryTest > getServiceTiingo() FAILED
org.opentest4j.AssertionFailedError at StockQuoteServiceFactoryTest.java:13


Please check for the spelling of tiingo in your code .

Please also refer to the following FAQ’s


I passed the last two test cases. but I don’t know why PortfolioManagerTest.java fails?

@ankit19
Please run the individual test case using

./gradlew test --tests com.crio.warmup.stock.portfolio.PortfolioManagerTest.calculateExtrapolatedAnnualizedReturn

and see the report to know what is the error.

I have also referred an FAQ in my earlier reply.

i Passed all test cases except ExtrapolatedAnnualizedReturn test case.
if i passed in module 4 why this test case fails here?

@ankit19 Once if you run the test, you will get to know, what was the issue and why it is failing.

As you are saying that you have passed that earlier modules itself, see if you have altered any of the code.

getting restTemplate shows null value.Also my build url is correct.
why my restTemplate shows null value?

assert has tiingo and your file has tingo

i corrected that part.
i stuck at java.lang.IllegalArgumentException at PortfolioManagerTest.java:117
My rest template has null value.

Hey, if your test restTemplate is null, you can assign it by using the new keyword

Closing this topic as there is no response since last 12 hours. Please feel free to create a new topic and post this question as a reference link in the description of the new topic.