ValidateSetInstancesCount implements SetServiceInstancesValidator { @Override public void validate(final SetServiceInstancesValidationContext validationContext) throws RestErrorException { int count = validationContext.getRequest().getCount(); if (count <= 0) { throw new RestErrorException(CloudifyErrorMessages.INVALID_INSTANCES_COUNT.getName(), count); } }  @Override void validate(final SetServiceInstancesValidationContext validationContext);  }
@Test public void zeroCountInSetInstances() { SetServiceInstancesValidationContext context = new SetServiceInstancesValidationContext(); SetServiceInstancesRequest request = new SetServiceInstancesRequest(); request.setCount(0); context.setRequest(request); SetServiceInstancesValidator validator = new ValidateSetInstancesCount(); ValidatorsTestsUtils.validate(validator , context, ERR_MSG); }
@Test public void negativeCountInSetInstances() { SetServiceInstancesValidationContext context = new SetServiceInstancesValidationContext(); SetServiceInstancesRequest request = new SetServiceInstancesRequest(); request.setCount(-1); context.setRequest(request); ValidatorsTestsUtils.validate(validator, context, ERR_MSG); }