Urf unread field

it is suggesting to remove it but in the module it is forbidden to change the constructor ?

so i tried passing the unused rest template into getStockQuote …

@anand-crio @Pallav_crio @Sakshat-Crio.Do

So the problem is not the constructor.
You have to use that constructor during implementation
You might not be doing that and so its giving unread field error

If you modify any of the method signatures provided by us, you will land into compilation errors either during test or assessment.

However, i would request you to read the error and try to understand what it says.

The file is available in your workspace. So you can find whats going wrong.

hey guys , can u be a little specific in hints :grinning:
i am not getting the use of rest template in PortfolioManagerImpl ,as I am using it in getStockQuote for the api call ?
@akashchhetri ?
@Sakshat-Crio.Do

Yeah, as well as in the portfolioManagerImpl you are using rest template for the api call.

so i should not call getStockquotes in PortfolioManagerImpl , rather i should implement that functionality here also . right ?

I implemeted it . i am getting ExtrapolatedAnnualizedReturn() failed as java.lang.IllegalArgumentException at PortfolioManagerTest.java:104

In this you have to follow factory pattern. Make an factory object and then call rest template through portfolio manager. You can refer to the diagram below for more clarity -

We do have a potential FAQ for this -

Hope this helps now :slight_smile:

I am getting IllegalArgumentException at PortfolioManagerTest.java .
arguments in calculateAnnualizedReturn method are list of portfolioTrades instances and Localdate . I checked in mainCalculateReturnsAfterRefactor method that i am passing the correct type ,
How it can be illegal ?

Within the calculateAnnualizedReturn you’ll have to use the getQuote function. Did you use it?

still the same error , whether i use it or not

can u plz look into my code ?

you need to declare the resttemplate as a variable first.
outside the constructor.

and in the pic u have posted it is showing arguments error so u need to pass correct arguments to the getstockquote method

@Pallav_crio can u share some insight on this ?
“I am getting IllegalArgumentException at PortfolioManagerTest.java .
arguments in calculateAnnualizedReturn method are list of portfolioTrades instances and Localdate . I checked in mainCalculateReturnsAfterRefactor method that i am passing the correct type ,
How it can be illegal ?”

how to resolve this error , i tried all possible ways ?
@Sakshat-Crio.Do
in the test file----
List annualizedReturns = portfolioManager.calculateAnnualizedReturn(portfolioTrades, LocalDate.parse(“2019-12-12”));
this line is showing IllegalArgument exception
@anand-crio

why readvalue is null :roll_eyes: