Knowledge Base > Legacy Information - JCover > Mocking
Using mocking with JCover
Mocking is an approach to unit testing that lets you make assertions about how the code under test is interacting with other system modules. JCover uses both Mockito and PowerMock. To use these, you will need to install the following dependencies:
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.2.5.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.2.4.RELEASE</version>
<scope>test</scope>
</dependency>
JCover has the following mocking help options:
To force mocking of the given class:
--mock class-name
To prevent mocking of the given class:
--no-mock class-name
To generate a stub for the given class:
--full-mock class-name
To use Powermock to mock specific static methods:
--powermock class-name
To use Powermock to mock all classes with static methods:
--powermock-static