Answer the question
In order to leave comments, you need to log in
Should nested methods be tested?
There is a calculate() method, inside this method the calculateAmount() method is called, in this method some calculations take place with some conditions.
So I write a unit test for the calculate() method. The question is: when testing this method, do I need to take into account the cases that are in calculateAmount() ?
Answer the question
In order to leave comments, you need to log in
If calculateAmount() is a public method, or another bean's method isn't, just wrap its result with whatever options you need.
If calculateAmount() is not a public method - yes, it should be taken into account.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question