The first case also allows you to inject mocks depending on the framework. For example using the @InjectMocks
annotation of Mockito. You also have ReflectionTestUtils.setField
in Spring test, ...
I'm personally not too fond of modifying classes too much for testing purposes, so I would go for the first case. But at the end of the day this mostly depends on your preferred test framework.