I have this in Mockito:
when(mockedMergeContext.createNewEntityOfType(IService.class)).thenReturn(new ServiceMock());
>
You might want to refactor that into different statements to understand why that happens.
Service svc = new ServiceMock();
when(mockedMergeContext.createNewEntityOfType(IService.class)).thenReturn( svc );
Do you see now why it doesn't work? :)
It's always returning the instance hold in svc, it won't re-evaluate new ServiceMock()
each time that the method is invoked.