Your problem seems to be resolved (mixing Spring dependency versions), but let me just expand on @ g00glen00b's comment on how to write unit tests.
Make sure the following dependency is in yours pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
As stated in the comment, it @RunWith(SpringJUnit4ClassRunner.class)forces the unit test to run the entire application and is used rather for integration testing.
, Spring -boot Mockito, .
unit test :
public class EmployeeRepositoryTest {
@InjectMocks
private EmployeeRepository employeeRepository;
@Mock
private Something something;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
}
@Test
public void insertEmploee(){
Employee employee = new Employee();
employee.setEmpName("Azad");
employee.setEmpDesignation("Engg");
employee.setEmpSalary(12.5f);
employeeRepository.save(employee);
Mockito.verify(...);
}
}
Mockito , , .