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()?

Zeus
  • 6,386
  • 6
  • 54
  • 89
  • It is not a duplicate, it did not solve my problem, could you please read my question? – Zeus Apr 20 '16 at 00: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. – Jeff Bowman Apr 20 '16 at 03:04

0 Answers0