UsernamePrincipal implements Principal, Serializable { @Override public String getName() { return this.userName; } UsernamePrincipal(final String userName); @Override String getName(); @Override String toString();  }
@Test public void canBeSerialized() throws Exception { String name = "jsmith"; UsernamePrincipal instance = new UsernamePrincipal(name); UsernamePrincipal cloned = (UsernamePrincipal) SerializationUtils.clone(instance); assertThat(cloned.getName()).isEqualTo(name); }