Junit Best Practice: a public method that calls several private methods

I'm starting to write JUnit test cases for an outdated codebase. One public method has several if statements and is based on the condition that it calls different private methods.
Do I have to write only one test method and check all conditions? or one method for each condition?

Will I not lose consistency if I write separate methods for each if condition?

What is the approach to checking private methods? The private logic of a method can be more complex than public methods.

+5
source share
3 answers

, , , .

, . , .

, , . , , .

+4

. , . , . , . ...

1 -

.

2 -

, , . . , , ?

+1

, . .

0
source

All Articles