@Test(expectedExceptions = ValidationException.class, expectedExceptionsMessageRegExp = "Unable to PUT an object without specifying an id") public void testPUTValidationNullId() { DefaultDataObjectRequest<Agenda> request = createAgendaRequest(null); request.setDataObject(new Agenda()); validator.validatePUT(request); }
@Override public void validatePUT(R request) { super.validatePUT(request); validateObjectRequest(request, "PUT"); if(request.getId() == null) throw new ValidationException(UNABLE_TO_PUT_WITHOUT_ID_EXCEPTION); T object = request.getDataObject(); if(object.getId() != null && !object.getId().equals(request.getId())) throw new ValidationException(String.format(MISMATCHED_PUT_ID_EXCEPTION, request.getId(), object.getId())); }
DataObjectValidator extends DefaultRequestValidator<R> { @Override public void validatePUT(R request) { super.validatePUT(request); validateObjectRequest(request, "PUT"); if(request.getId() == null) throw new ValidationException(UNABLE_TO_PUT_WITHOUT_ID_EXCEPTION); T object = request.getDataObject(); if(object.getId() != null && !object.getId().equals(request.getId())) throw new ValidationException(String.format(MISMATCHED_PUT_ID_EXCEPTION, request.getId(), object.getId())); } }
DataObjectValidator extends DefaultRequestValidator<R> { @Override public void validatePUT(R request) { super.validatePUT(request); validateObjectRequest(request, "PUT"); if(request.getId() == null) throw new ValidationException(UNABLE_TO_PUT_WITHOUT_ID_EXCEPTION); T object = request.getDataObject(); if(object.getId() != null && !object.getId().equals(request.getId())) throw new ValidationException(String.format(MISMATCHED_PUT_ID_EXCEPTION, request.getId(), object.getId())); }  }
DataObjectValidator extends DefaultRequestValidator<R> { @Override public void validatePUT(R request) { super.validatePUT(request); validateObjectRequest(request, "PUT"); if(request.getId() == null) throw new ValidationException(UNABLE_TO_PUT_WITHOUT_ID_EXCEPTION); T object = request.getDataObject(); if(object.getId() != null && !object.getId().equals(request.getId())) throw new ValidationException(String.format(MISMATCHED_PUT_ID_EXCEPTION, request.getId(), object.getId())); }  @Override void validatePOST(R request); @Override void validatePUT(R request); }
DataObjectValidator extends DefaultRequestValidator<R> { @Override public void validatePUT(R request) { super.validatePUT(request); validateObjectRequest(request, "PUT"); if(request.getId() == null) throw new ValidationException(UNABLE_TO_PUT_WITHOUT_ID_EXCEPTION); T object = request.getDataObject(); if(object.getId() != null && !object.getId().equals(request.getId())) throw new ValidationException(String.format(MISMATCHED_PUT_ID_EXCEPTION, request.getId(), object.getId())); }  @Override void validatePOST(R request); @Override void validatePUT(R request);  }