У меня есть проект Spring-boot и REST API.Я пытаюсь проверить операцию findAll @GET.Следующий тестовый пример для метода отображения всех записей.
@Before
public void setUp() throws Exception {
mockMvc = MockMvcBuilders.standaloneSetup(batchJobConfigController).build();
}
@Test
public void testBatchJobConfigs() throws Exception {
BatchJobConfigDTO mockBatchJobConfigDTO = new BatchJobConfigDTO("Doctor", "ER Doctor", "Started", "Full Time");
batchJobConfigDTOs.add(mockBatchJobConfigDTO);
when(mockBatchJobConfigService.findAllBatchJobConfigs()).thenReturn(batchJobConfigDTOs);
mockMvc.perform(get("/configs").accept(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.jsonPath("$.jobNm", Matchers.is("Enginerring")))
.andExpect(MockMvcResultMatchers.jsonPath("$.jobDesc", Matchers.is("Coding, Testing and stuff")))
.andExpect(MockMvcResultMatchers.jsonPath("$.status", Matchers.is("Progress")))
.andExpect(MockMvcResultMatchers.jsonPath("$.jobType", Matchers.is("INFA")));
verify(mockBatchJobConfigService, times(1)).findAllBatchJobConfigs();
verifyNoMoreInteractions(mockBatchJobConfigService);
}
Я получаю следующий запуск в JUnit4.В чем может быть причина?
java.lang.IllegalStateException: Configuration error: found multiple declarations of @BootstrapWith for test class [com.controller.BatchJobConfigControllerTest]: