Spring configuration options
To set your Spring configuration options for Cover Plugin go to Diffblue > Change Settings > Spring
in IntelliJ.
Mocking in Spring integration tests
Check the Enable integration tests
option to limit mocking for Spring projects to Repository dependencies only - Spring handles the rest directly. If this option is not selected then mocking may be implemented for a wider scope of dependencies.
Spring Repositories are classes implementing
org.springframework.data.repository.Repository
or those annotated withorg.springframework.stereotype.Repository
.This option is not applied when creating tests for
@Controller
classes.
Spring contexts
Check the Use Spring contexts
option to enable Spring contexts for dependency injection in tests written by Diffblue Cover.
Spring Boot Tests
Check the Use Spring Boot to write tests
option for dependency injection using, amongst the others,@MockBean
. If this option is not enabled Cover will instead fall back to other dependency injection mechanisms for tests such as Mockito's @InjectMocks
and @Mock
. This option may be useful depending on whether or not a Spring context needs to be loaded for a particular unit test suite.
Note: This functionality is in Beta stage, hence there could be cases where some inconsistencies and limitations might still be present.
Active profiles
Use the Active Profiles
text box to specify one or more Spring profiles to activate while writing tests (comma separated list). If no profiles are defined, Cover will automatically use the test
profile (if available), otherwise the default Spring profile will be used.
Last updated