Stubbing error in portfolioManagerImp.java

Strict stubbing argument mismatch. Please check:
 - this invocation of 'getStockQuote' method:

please help

Please use the below links for reference, let me know if it was helpful or not.


i am using get stock quote inside calculateAnnualised function

i have read them
it says to use getstockquote inside calculateAnnualised function

Have you modified the return type of this function? Like is it different from the original when it was pulled?

org.mockito.exceptions.misusing.PotentialStubbingProblem: 
Strict stubbing argument mismatch. Please check:
 - this invocation of 'getStockQuote' method:
    portfolioManager.getStockQuote(
    "aapl",
    2019-01-02,
    2019-12-12
);
    -> at com.crio.warmup.stock.portfolio.PortfolioManagerImpl.calculateAnnualizedReturn(PortfolioManagerImpl.java:77)
 - has following stubbing(s) with different arguments:
    1. portfolioManager.getStockQuote(
    null,
    null,
    null
);
      -> at com.crio.warmup.stock.portfolio.PortfolioManagerTest.calculateExtrapolatedAnnualizedReturn(PortfolioManagerTest.java:89)
    2. portfolioManager.getStockQuote(
    null,
    null,
    null
);
      -> at com.crio.warmup.stock.portfolio.PortfolioManagerTest.calculateExtrapolatedAnnualizedReturn(PortfolioManagerTest.java:91)
    3. portfolioManager.getStockQuote(
    null,
    null,
    null
);
      -> at com.crio.warmup.stock.portfolio.PortfolioManagerTest.calculateExtrapolatedAnnualizedReturn(PortfolioManagerTest.java:93)
Typically, stubbing argument mismatch indicates user mistake when writing tests.
Mockito fails early so that you can debug potential problem easily.
However, there are legit scenarios when this exception generates false negative signal:
  - stubbing the same method multiple times using 'given().will()' or 'when().then()' API
    Please use 'will().given()' or 'doReturn().when()' API for stubbing.
  - stubbed method is intentionally invoked with different arguments by code under test
    Please use default or 'silent' JUnit Rule (equivalent of Strictness.LENIENT).

it should return a list of List type right??

I don’t remember what it should be, but I do remember I tried changing it and got an error. It wasn’t supposed to be modified. Hence the question.

@Saurav_Crio.Docan you please check my code where i am going wrong

Hey @tijira i have just checked your workspace i think everything is working fine you are good to go

Hey, how are you doing this? I am getting an error which says you cannot call a non-static method inside a static one.