@Test
public void testToThrift() throws DestroyFailedException {
// verify thrift serialization
Credentials creds = new Credentials("test", new PasswordToken("testing"));
TCredentials tCreds = creds.toThrift(new MockInstance());
assertEquals("test", tCreds.getPrincipal());
assertEquals(PasswordToken.class.getName(), tCreds.getTokenClassName());
assertArrayEquals(AuthenticationTokenSerializer.serialize(new PasswordToken("testing")), tCreds.getToken());
// verify that we can't serialize if it's destroyed
creds.getToken().destroy();
try {
creds.toThrift(new MockInstance());