### Question:
Token { public <T> void setAttribute(CoreTokenField field, T value) { if (isFieldReadOnly(field)) { throw new IllegalArgumentException(MessageFormat.format( "Token Field {0} is read only and cannot be set.", field.toString())); } try { CoreTokenFieldTypes.validateType(field, value); } catch (CoreTokenException e) { throw new IllegalArgumentException(e.getMessage(), e); } put(field, value); } private  Token();  Token(String tokenId, TokenType type);  Token(Token copy); String getTokenId(); TokenType getType(); String getUserId(); void setUserId(String userId); Calendar getExpiryTimestamp(); void setExpiryTimestamp(Calendar expiryDate); byte[] getBlob(); void setBlob(byte[] data); Collection<CoreTokenField> getAttributeNames(); T getValue(CoreTokenField field); void setAttribute(CoreTokenField field, T value); void clearAttribute(CoreTokenField field); static boolean isFieldReadOnly(CoreTokenField field); @Override String toString();  }### Answer:
@Test public void shouldCopyToken() { Token token = new Token("badger", TokenType.SAML2); token.setAttribute(CoreTokenField.INTEGER_ONE, 1234); token.setAttribute(CoreTokenField.STRING_ONE, "Weasel"); token.setAttribute(DATE_ONE, getCalendarInstance()); Token result = new Token(token); TokenTestUtils.assertTokenEquals(result, token); }
@Test public void shouldCopyToken() { Token token = new Token("badger", TokenType.SAML2); token.setAttribute(CoreTokenField.INTEGER_ONE, 1234); token.setAttribute(CoreTokenField.STRING_ONE, "Weasel"); token.setAttribute(CoreTokenField.DATE_ONE, Calendar.getInstance()); Token result = new Token(token); TokenTestUtils.assertTokenEquals(result, token); }