code: protected void validateAttachmentContentId(SoapAttachment receivedAttachment, SoapAttachment controlAttachment) {
          //in case contentId was not set in test case, skip validation 
          if (!StringUtils.hasText(controlAttachment.getContentId())) { return; }
          
          if (receivedAttachment.getContentId() != null) {
              Assert.isTrue(controlAttachment.getContentId() != null, 
                      buildValidationErrorMessage("Values not equal for attachment contentId", 
                              null, receivedAttachment.getContentId()));
  
              Assert.isTrue(receivedAttachment.getContentId().equals(controlAttachment.getContentId()),
                      buildValidationErrorMessage("Values not equal for attachment contentId", 
                              controlAttachment.getContentId(), receivedAttachment.getContentId()));
          } else {
              Assert.isTrue(controlAttachment.getContentId() == null || controlAttachment.getContentId().length() == 0, 
                      buildValidationErrorMessage("Values not equal for attachment contentId", 
                              controlAttachment.getContentId(), null));
          }
          
          if (log.isDebugEnabled()) {
              log.debug("Validating attachment contentId: " + receivedAttachment.getContentId() + 
                      "='" + controlAttachment.getContentId() + "': OK.");
          }
      }
docs: Validating SOAP attachment content id.
  @param receivedAttachment
  @param controlAttachment