Click here to Skip to main content
15,168,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to write unit test in junit for a method, the method is inside class A and class A extends Class B. My testing method methodA() calls another methodB() which is inside class B. So how should I mock this methodB() call so that when I call methodA() from my testCase, it get passed?
Which class should I mock, classA or Class B?

What I have tried:

ClassA obj=new ClassA();
ClassB mockClsB=mock(ClassB.class);
int expected=10;
int result=obj.methodA();
Gerry Schmitz 26-May-19 14:47pm
Ask QA; they're the only ones that care.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900