AttachmentAccessToken implements SignedExpiringToken { @Override public String getPayload() { return username + SEPARATOR + DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(expirationDate); } @VisibleForTesting  AttachmentAccessToken(String username, String blobId, ZonedDateTime expirationDate, String signature); static Builder builder(); static AttachmentAccessToken from(String serializedAttachmentAccessToken, String blobId); String getBlobId(); String getUsername(); @Override ZonedDateTime getExpirationDate(); @Override String getSignature(); String serialize(); @Override String getPayload(); @Override String getSignedContent(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); static final String SEPARATOR; }
@Test public void getPayloadShouldNotContainBlobId() { assertThat(new AttachmentAccessToken(USERNAME, BLOB_ID, EXPIRATION_DATE, SIGNATURE).getPayload()) .isEqualTo(USERNAME + AttachmentAccessToken.SEPARATOR + EXPIRATION_DATE_STRING); }