Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public void whenAddCalledRealMethodCalled ( ) { doCallRealMethod ( ) . when ( myList ) . add ( any ( Integer . class ) ) ;

public void whenAddCalledRealMethodCalled(){ doCallRealMethod().when(myList).add(any (Integer.class)); myList.size(); verify(myList, times(1)).size(); assertEquals(15, 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 15 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(15, result);
The code won't complie. You can't mock ArrayList.class for List
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Demonstrate three aspects of assessing group performance?

Answered: 1 week ago