リポジトリ オブジェクトがテストケース クラスに挿入されません。これが私の以下のテストクラスコードです
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classesExternalProviderMain.class)
@ActiveProfiles(ApplicationConstants.DEVELOPMENT_PROFILE)
@WebAppConfiguration
public class EmployeeServiceTest {
@InjectMocks
EmployeeService employeeService; //not injected null
@Mock
EmployeeRepository employeeRepository;//not injected null
@Test
public void testEmployee() {
Mockito.when(employeeRepository.findByName(Stringname)).thenReturn(getEmployee());
List<Employee> resultedTrackbles = employeeService.getEmployeeByName("mike");
}
private List<Employee> getEmployee(){
//here is the logic to return List<Employees>
}
}
「EmployeeRepository」を挿入する方法を教えてください。追加のロジックを記述する必要があります。