java - Junit Best Practice: Public method calling multiple private methods -


i starting write junit test cases legacy codebase. 1 of public methods has multiple if statements , based on condition calling different private methods.
should write 1 test method , test conditions? or one method each condition?

wouldn't lose consistency if write individual methods each if condition?

what approach test private methods? private method logic more complicated public methods.

base number of methods on number of scenarios want test, has nothing methods thing being tested has.

if each scenario takes own code set up, 1 test method each scenario. if can parameterize tests may able have 1 test method , pass in different data each scenario.

the important thing each combination of inputs want test succeed or fail independently of other tests. if shoehorn tests 1 method can't happen, first test failure prevent remaining tests running.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -