hey, so for lack of time & will I ended up making half coverage. I solved the HandlerExceptionResolver error getting a good service/repository coverage with @DataJpaTest
but when moving on to integration testing the controller it complains giving me all those errors...
this is now the erro I'm getting: Error creating bean with name 'applicationLoggingAspect' defined in file [...] Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'applicationService' defined in file
This is how I've set up my testing suite:
@WebMvcTest(UserController.class)
@ActiveProfiles("test")
public class UserControllerTest {
@MockBean
private UserService userService;
@Autowired
private MockMvc mockMvc;
@MockBean
private RoleService roleService;
@Test
void auth() throws Exception {
UserDto dto= createBasicDto();
when(userService.getUserDtoByKey(eq(dto.getKey()))).thenReturn(dto);
mockMvc.perform(get("/users/auth/")
.header("key",dto.getKey()))
.andExpect(status().isAccepted());
}
}
applicationLoggingAspect is an aspect class that just takes up a service and its dto. I use it to log stuff inside my api...
@Aspect
@Component
@Slf4j
public class ApplicationLoggingAspect extends BaseLoggingAspect<ApplicationService, ApplicationDto> {
public ApplicationLoggingAspect(ApplicationService service) {
super(service);
}
@Autowired
LogService logService;
[...]
}```