Question: public void whenAddCalledRealMethodCalled ( ) { doCallRealMethod ( ) . when ( myList ) . add ( any ( Integer . class ) ) ;
public void whenAddCalledRealMethodCalled doCallRealMethodwhenmyListaddany Integerclass; myList.size; verifymyList timessize; assertEquals result;
Which of the following statements is true regarding the whenAddCalledRealMethodCalled test method?
Pick ONE option
It passes Test successfully. It will call ArrayList's add real method call and it will add to list.
It will fail. It's call to ArrayList's add method is working but it's mocked and get method is gonna return null. It will fail at
assertEquals result;
The code won't complie. You can't mock ArrayList.class for List
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
