### Question:
ActingPrincipal implements Principal, Serializable { public boolean equals( Object other ) { if ( other instanceof ActingPrincipal ) { ActingPrincipal that = (ActingPrincipal) other; return ( this.isAnonymous() && that.isAnonymous() ) || ( this.getName() != null && this.getName().equals( that.getName() ) ); } else { return false; } } ActingPrincipal( String name ); private  ActingPrincipal(); @Override String getName(); boolean equals( Object other ); String toString(); 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 ) ); }