Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started