### Question:
ActingPrincipal implements Principal, Serializable { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } ActingPrincipal that = (ActingPrincipal) o; if ( isAnonymous() != that.isAnonymous() ) { return false; } return getName() != null ? getName().equals( that.getName() ) : that.getName() == null; } ActingPrincipal( String name ); private  ActingPrincipal(); @Override String getName(); String toString(); @Override boolean equals( Object o ); @Override int hashCode(); boolean isAnonymous(); static final ActingPrincipal ANONYMOUS; }### Answer:
@Test public void equals() throws Exception { principal1 = new ActingPrincipal( "suzy" ); principal2 = new ActingPrincipal( "joe" ); assertFalse( principal1.equals( principal2 ) ); assertFalse( principal1.equals( ActingPrincipal.ANONYMOUS ) ); principal2 = new ActingPrincipal( "suzy" ); assertTrue( principal1.equals( principal2 ) ); principal2 = ActingPrincipal.ANONYMOUS; assertTrue( principal2.equals( ActingPrincipal.ANONYMOUS ) ); }