How to debug portfoliomanagerimpl.java

I have put some breakpoints in this file(portfoliomanagerimpl.java) and want to debug…I have written some code and need to check their values…when I try to do that,. It goes to portfoliomangerapplication.java, and then am not able to check any of the values in portfoliomanagerimpl.java
So how to deal with this.

And also in portfoliomangerapplication.java while returning we call portfolio manager.calculateannualizedreturn(…)
…am trying to create portfoliomanager using portfoliomanagerfactory, but what to pass in resttemplate at this point?

(in portfoliomanagerfactory I haven’t done anything much, am only creating PortfolioManager by passing restTemplate to PortfolioManagerImpl and returning newly created PortfolioManager …Is that correct… or something more needs to be done here?)

Passing restTemplate to method portfolioManagerFactory is just fine.
The portfolioManagerFactory must return an instance of PortfolioManagerImpl. This is how your debugger will be delegated to PortfolioManagerImpl
And regarding testing , if you want to test the code in PortfolioManagerImpl then u must test it with PortfolioManagerTest.I hope it helps

1 Like

Hey you can go through the below 2 FAQ,'s to understand as to what has to be done.


https://forum.crio.do/t/how-do-i-create-an-interface-object/7781/2
You will get an Idea as to what has to be done :slight_smile:

The problem with the debug is resolved. Earlier I used the same method, but before it reached my 1st breakpoint, there was some error and I got a failed test report.

1 Like

@Rahul-Crio.do @yakshit
this time I went thoroughly through all the FAQs before jumping into the module(cz of bad old experience, not seeing those FAQs :sweat_smile:)…and indeed it was helpful.

I have done most of the things…but not able to understand what to send while calling .getPortfolioManager(restTemplate) of Porfoliomanagerfactory…how should I initialize this restTemplate with?
or if at all am wrong…please let me know

Hey you basically have to link the Factory to your application class now, this is basically passing over the main functionality to Factory, and the factory basically controls everything.
You just have to make the right function call :wink:

1 Like


You can refer this blog.
It has beautifully explained about the error

Ooops! I read that article earlier…but not with enough attention :sweat_smile:
thanks man.