@Test public void when_configuration_has_code_scan_config_at__missingScanDefinitionError_occurs_NOT() { when(target.getCodeScan()).thenReturn(Optional.of(Mockito.mock(SecHubCodeScanConfiguration.class))); when(target.getInfraScan()).thenReturn(Optional.empty()); when(target.getWebScan()).thenReturn(Optional.empty()); validatorToTest.validate(target, errors); assertNoMissingScanDefinitionError(); }
@Override public void validate(Object target, Errors errors) { LOG.debug("Start validation for: {}", target); SecHubConfiguration configuration = (SecHubConfiguration) target; validateAPI(configuration, errors); validateAtLeastOneScanConfiguration(configuration, errors); validateWebScan(configuration, errors); validateInfraScan(configuration, errors); if (errors.hasErrors()) { List<ObjectError> objectErrors = errors.getAllErrors(); for (ObjectError error : objectErrors) { LOG.info("Rejected sechub configuration from user:{}. Reason: {}", userContextService.getUserId(), error.getDefaultMessage()); } } }
SecHubConfigurationValidator implements Validator { @Override public void validate(Object target, Errors errors) { LOG.debug("Start validation for: {}", target); SecHubConfiguration configuration = (SecHubConfiguration) target; validateAPI(configuration, errors); validateAtLeastOneScanConfiguration(configuration, errors); validateWebScan(configuration, errors); validateInfraScan(configuration, errors); if (errors.hasErrors()) { List<ObjectError> objectErrors = errors.getAllErrors(); for (ObjectError error : objectErrors) { LOG.info("Rejected sechub configuration from user:{}. Reason: {}", userContextService.getUserId(), error.getDefaultMessage()); } } } }
SecHubConfigurationValidator implements Validator { @Override public void validate(Object target, Errors errors) { LOG.debug("Start validation for: {}", target); SecHubConfiguration configuration = (SecHubConfiguration) target; validateAPI(configuration, errors); validateAtLeastOneScanConfiguration(configuration, errors); validateWebScan(configuration, errors); validateInfraScan(configuration, errors); if (errors.hasErrors()) { List<ObjectError> objectErrors = errors.getAllErrors(); for (ObjectError error : objectErrors) { LOG.info("Rejected sechub configuration from user:{}. Reason: {}", userContextService.getUserId(), error.getDefaultMessage()); } } }  }
SecHubConfigurationValidator implements Validator { @Override public void validate(Object target, Errors errors) { LOG.debug("Start validation for: {}", target); SecHubConfiguration configuration = (SecHubConfiguration) target; validateAPI(configuration, errors); validateAtLeastOneScanConfiguration(configuration, errors); validateWebScan(configuration, errors); validateInfraScan(configuration, errors); if (errors.hasErrors()) { List<ObjectError> objectErrors = errors.getAllErrors(); for (ObjectError error : objectErrors) { LOG.info("Rejected sechub configuration from user:{}. Reason: {}", userContextService.getUserId(), error.getDefaultMessage()); } } }  @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); }
SecHubConfigurationValidator implements Validator { @Override public void validate(Object target, Errors errors) { LOG.debug("Start validation for: {}", target); SecHubConfiguration configuration = (SecHubConfiguration) target; validateAPI(configuration, errors); validateAtLeastOneScanConfiguration(configuration, errors); validateWebScan(configuration, errors); validateInfraScan(configuration, errors); if (errors.hasErrors()) { List<ObjectError> objectErrors = errors.getAllErrors(); for (ObjectError error : objectErrors) { LOG.info("Rejected sechub configuration from user:{}. Reason: {}", userContextService.getUserId(), error.getDefaultMessage()); } } }  @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors);  }