0

I tried the solution to which it was marked as duplicate, but it did not solve my issue.

I am running a mockito test on a oneMethod() which is inturn calling 'internalMethod1()' , the mockito setup that we have is something like this

@RunWith(MockitoJUnitRunner.class)
public class ServiceImplTest {
@Mock
    public TdsAllResourcesQueryPortMod getResourceWS;

    @InjectMocks
    private ServiceImpl service = new ServiceImpl();

    @Test
    public void testing(){
        .....
        service.oneMethod();
    }

class ServiceImpl

public class ServiceImpl {
    public oneMethod(){
        internalMethod1();
    }

    public internalMethod1(){
       ...
    }

}

Is there a good way to avoid the internalmethod1() call? or can I mock the response from this internalMethod1()?

2
  • It is not a duplicate, it did not solve my problem, could you please read my question? Commented Apr 20, 2016 at 0:50
  • I agree with JB Nizet that the solution you want is partial mocking and that you can either do that with thenCallRealMethod (dupe answer 1) or a spy (dupe answer 2). If neither of those is sufficient, please add detail about how. Commented Apr 20, 2016 at 3:04

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.