With PowerMock you can mock constructors. See example
I'm not with an IDE right now, but would be something like this:
UserQueries userQueries = PowerMockito.mock(UserQueries.class);
PowerMockito.whenNew(UserQueries.class).withArguments(Mockito.any(CrudService.class)).thenReturn(userQueries);
You need to run your test with PowerMockRunner
(add these annotations to your test class):
@RunWith(PowerMockRunner.class)
@PrepareForTest(UserQueries .class)
If you cannot use PowerMock, you have to inject a factory, as it says @Briggo answer.
Hope it helps
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…