@Test public void test() { boolean validated; try { defaultWirecardAuthenticationValidateInterceptor.onValidate(authentication, interceptorContext); validated = true; } catch (InterceptorException e) { validated = false; } assertEquals(expected, validated); }
@Override public void onValidate(Object model, InterceptorContext ctx) throws InterceptorException { if (model instanceof WirecardAuthenticationModel) { final WirecardAuthenticationModel authenticationModel = (WirecardAuthenticationModel) model; if (ctx.isNew(model) || ctx.isModified(model, WirecardAuthenticationModel.USERNAME) || ctx.isModified(model, WirecardAuthenticationModel.PASSWORD)) { if (!ctx.isNew(authenticationModel)) { registerAuthenticationForRemovalIfNeeded(authenticationModel); LOG.debug(MODIFY_MESSAGE); } else { registerAuthenticationForRemovalIfNeeded(authenticationModel); LOG.debug(NEW_MESSAGE); } } if ((ctx.isNew(model) || ctx.isModified(model, WirecardAuthenticationModel.CREDITORID)) && authenticationModel.getCode().contains("wd-sepadebit") && StringUtils.isEmpty(authenticationModel.getCreditorId())) { throw new InterceptorException( ERROR_MESSAGE_CREDITOR); } } }
DefaultWirecardAuthenticationValidateInterceptor implements ValidateInterceptor { @Override public void onValidate(Object model, InterceptorContext ctx) throws InterceptorException { if (model instanceof WirecardAuthenticationModel) { final WirecardAuthenticationModel authenticationModel = (WirecardAuthenticationModel) model; if (ctx.isNew(model) || ctx.isModified(model, WirecardAuthenticationModel.USERNAME) || ctx.isModified(model, WirecardAuthenticationModel.PASSWORD)) { if (!ctx.isNew(authenticationModel)) { registerAuthenticationForRemovalIfNeeded(authenticationModel); LOG.debug(MODIFY_MESSAGE); } else { registerAuthenticationForRemovalIfNeeded(authenticationModel); LOG.debug(NEW_MESSAGE); } } if ((ctx.isNew(model) || ctx.isModified(model, WirecardAuthenticationModel.CREDITORID)) && authenticationModel.getCode().contains("wd-sepadebit") && StringUtils.isEmpty(authenticationModel.getCreditorId())) { throw new InterceptorException( ERROR_MESSAGE_CREDITOR); } } } }
DefaultWirecardAuthenticationValidateInterceptor implements ValidateInterceptor { @Override public void onValidate(Object model, InterceptorContext ctx) throws InterceptorException { if (model instanceof WirecardAuthenticationModel) { final WirecardAuthenticationModel authenticationModel = (WirecardAuthenticationModel) model; if (ctx.isNew(model) || ctx.isModified(model, WirecardAuthenticationModel.USERNAME) || ctx.isModified(model, WirecardAuthenticationModel.PASSWORD)) { if (!ctx.isNew(authenticationModel)) { registerAuthenticationForRemovalIfNeeded(authenticationModel); LOG.debug(MODIFY_MESSAGE); } else { registerAuthenticationForRemovalIfNeeded(authenticationModel); LOG.debug(NEW_MESSAGE); } } if ((ctx.isNew(model) || ctx.isModified(model, WirecardAuthenticationModel.CREDITORID)) && authenticationModel.getCode().contains("wd-sepadebit") && StringUtils.isEmpty(authenticationModel.getCreditorId())) { throw new InterceptorException( ERROR_MESSAGE_CREDITOR); } } }  }
DefaultWirecardAuthenticationValidateInterceptor implements ValidateInterceptor { @Override public void onValidate(Object model, InterceptorContext ctx) throws InterceptorException { if (model instanceof WirecardAuthenticationModel) { final WirecardAuthenticationModel authenticationModel = (WirecardAuthenticationModel) model; if (ctx.isNew(model) || ctx.isModified(model, WirecardAuthenticationModel.USERNAME) || ctx.isModified(model, WirecardAuthenticationModel.PASSWORD)) { if (!ctx.isNew(authenticationModel)) { registerAuthenticationForRemovalIfNeeded(authenticationModel); LOG.debug(MODIFY_MESSAGE); } else { registerAuthenticationForRemovalIfNeeded(authenticationModel); LOG.debug(NEW_MESSAGE); } } if ((ctx.isNew(model) || ctx.isModified(model, WirecardAuthenticationModel.CREDITORID)) && authenticationModel.getCode().contains("wd-sepadebit") && StringUtils.isEmpty(authenticationModel.getCreditorId())) { throw new InterceptorException( ERROR_MESSAGE_CREDITOR); } } }  @Override void onValidate(Object model, InterceptorContext ctx); @Required void setWirecardPaymentCommandService(DefaultWirecardPaymentCommandService wirecardPaymentCommandService); @Required void setWirecardPaymentConfigurationService(WirecardPaymentConfigurationService wirecardPaymentConfigurationService); }
DefaultWirecardAuthenticationValidateInterceptor implements ValidateInterceptor { @Override public void onValidate(Object model, InterceptorContext ctx) throws InterceptorException { if (model instanceof WirecardAuthenticationModel) { final WirecardAuthenticationModel authenticationModel = (WirecardAuthenticationModel) model; if (ctx.isNew(model) || ctx.isModified(model, WirecardAuthenticationModel.USERNAME) || ctx.isModified(model, WirecardAuthenticationModel.PASSWORD)) { if (!ctx.isNew(authenticationModel)) { registerAuthenticationForRemovalIfNeeded(authenticationModel); LOG.debug(MODIFY_MESSAGE); } else { registerAuthenticationForRemovalIfNeeded(authenticationModel); LOG.debug(NEW_MESSAGE); } } if ((ctx.isNew(model) || ctx.isModified(model, WirecardAuthenticationModel.CREDITORID)) && authenticationModel.getCode().contains("wd-sepadebit") && StringUtils.isEmpty(authenticationModel.getCreditorId())) { throw new InterceptorException( ERROR_MESSAGE_CREDITOR); } } }  @Override void onValidate(Object model, InterceptorContext ctx); @Required void setWirecardPaymentCommandService(DefaultWirecardPaymentCommandService wirecardPaymentCommandService); @Required void setWirecardPaymentConfigurationService(WirecardPaymentConfigurationService wirecardPaymentConfigurationService);  }