@Test(expected = ValidationException.class) public void testValidateFailureInvalidFollowingStatus() { SetFollowingStatusRequest request = new SetFollowingStatusRequest("ntaccount", "followingntaccount", EntityType.PERSON, false, Follower.FollowerStatus.NOTSPECIFIED); ServiceActionContext currentContext = new ServiceActionContext(request, principalMock); sut.validate(currentContext); }
@Override public void validate(final PrincipalActionContext inActionContext) throws ValidationException { SetFollowingStatusRequest inRequest = (SetFollowingStatusRequest) inActionContext.getParams(); ValidationException vex = new ValidationException(); if (inRequest.getTargetUniqueId().length() <= 0) { vex.addError("FollowerAndTarget", "This action requires a target unique id"); logger.error("Validation error - " + vex.getErrors().get("FollowerAndTarget")); throw vex; } if (inRequest.getFollowerStatus().equals(Follower.FollowerStatus.NOTSPECIFIED)) { vex.addError("FollowingStatus", "This action does not accept setting FollowerStatus of NOTSPECIFIED"); logger.error("Validation error - " + vex.getErrors().get("FollowingStatus")); throw vex; } decoratorValidationStrategy.validate(inActionContext); }
SetFollowingStatusBaseValidation implements ValidationStrategy<PrincipalActionContext> { @Override public void validate(final PrincipalActionContext inActionContext) throws ValidationException { SetFollowingStatusRequest inRequest = (SetFollowingStatusRequest) inActionContext.getParams(); ValidationException vex = new ValidationException(); if (inRequest.getTargetUniqueId().length() <= 0) { vex.addError("FollowerAndTarget", "This action requires a target unique id"); logger.error("Validation error - " + vex.getErrors().get("FollowerAndTarget")); throw vex; } if (inRequest.getFollowerStatus().equals(Follower.FollowerStatus.NOTSPECIFIED)) { vex.addError("FollowingStatus", "This action does not accept setting FollowerStatus of NOTSPECIFIED"); logger.error("Validation error - " + vex.getErrors().get("FollowingStatus")); throw vex; } decoratorValidationStrategy.validate(inActionContext); } }
SetFollowingStatusBaseValidation implements ValidationStrategy<PrincipalActionContext> { @Override public void validate(final PrincipalActionContext inActionContext) throws ValidationException { SetFollowingStatusRequest inRequest = (SetFollowingStatusRequest) inActionContext.getParams(); ValidationException vex = new ValidationException(); if (inRequest.getTargetUniqueId().length() <= 0) { vex.addError("FollowerAndTarget", "This action requires a target unique id"); logger.error("Validation error - " + vex.getErrors().get("FollowerAndTarget")); throw vex; } if (inRequest.getFollowerStatus().equals(Follower.FollowerStatus.NOTSPECIFIED)) { vex.addError("FollowingStatus", "This action does not accept setting FollowerStatus of NOTSPECIFIED"); logger.error("Validation error - " + vex.getErrors().get("FollowingStatus")); throw vex; } decoratorValidationStrategy.validate(inActionContext); } SetFollowingStatusBaseValidation(
            final ValidationStrategy<PrincipalActionContext> inDecoratorValidationStrategy); }
SetFollowingStatusBaseValidation implements ValidationStrategy<PrincipalActionContext> { @Override public void validate(final PrincipalActionContext inActionContext) throws ValidationException { SetFollowingStatusRequest inRequest = (SetFollowingStatusRequest) inActionContext.getParams(); ValidationException vex = new ValidationException(); if (inRequest.getTargetUniqueId().length() <= 0) { vex.addError("FollowerAndTarget", "This action requires a target unique id"); logger.error("Validation error - " + vex.getErrors().get("FollowerAndTarget")); throw vex; } if (inRequest.getFollowerStatus().equals(Follower.FollowerStatus.NOTSPECIFIED)) { vex.addError("FollowingStatus", "This action does not accept setting FollowerStatus of NOTSPECIFIED"); logger.error("Validation error - " + vex.getErrors().get("FollowingStatus")); throw vex; } decoratorValidationStrategy.validate(inActionContext); } SetFollowingStatusBaseValidation(
            final ValidationStrategy<PrincipalActionContext> inDecoratorValidationStrategy); @Override void validate(final PrincipalActionContext inActionContext); }
SetFollowingStatusBaseValidation implements ValidationStrategy<PrincipalActionContext> { @Override public void validate(final PrincipalActionContext inActionContext) throws ValidationException { SetFollowingStatusRequest inRequest = (SetFollowingStatusRequest) inActionContext.getParams(); ValidationException vex = new ValidationException(); if (inRequest.getTargetUniqueId().length() <= 0) { vex.addError("FollowerAndTarget", "This action requires a target unique id"); logger.error("Validation error - " + vex.getErrors().get("FollowerAndTarget")); throw vex; } if (inRequest.getFollowerStatus().equals(Follower.FollowerStatus.NOTSPECIFIED)) { vex.addError("FollowingStatus", "This action does not accept setting FollowerStatus of NOTSPECIFIED"); logger.error("Validation error - " + vex.getErrors().get("FollowingStatus")); throw vex; } decoratorValidationStrategy.validate(inActionContext); } SetFollowingStatusBaseValidation(
            final ValidationStrategy<PrincipalActionContext> inDecoratorValidationStrategy); @Override void validate(final PrincipalActionContext inActionContext);  }