@Test public void testEquals() { RoboconfError def1 = new RoboconfError( ErrorCode.CMD_CANNOT_HAVE_ANY_PARENT ); RoboconfError def2 = new RoboconfError( ErrorCode.CMD_CANNOT_HAVE_ANY_PARENT, component( "details" )); RoboconfError def3 = new RoboconfError( ErrorCode.CMD_CONFLICTING_INSTANCE_NAME, component( "details" )); Assert.assertTrue( def1.equals( def1 )); Assert.assertTrue( def1.equals( new RoboconfError( ErrorCode.CMD_CANNOT_HAVE_ANY_PARENT ))); Assert.assertFalse( def1.equals( null )); Assert.assertFalse( def1.equals( new Object())); Assert.assertFalse( def1.equals( def2 )); Assert.assertFalse( def1.equals( def3 )); Assert.assertTrue( def2.equals( def2 )); Assert.assertTrue( def2.equals( new RoboconfError( ErrorCode.CMD_CANNOT_HAVE_ANY_PARENT, component( "details" )))); Assert.assertFalse( def2.equals( def3 )); Assert.assertFalse( def2.equals( def1 )); RoboconfError def4 = new RoboconfError( ErrorCode.PROJ_NO_RESOURCE_DIRECTORY, component( "vm" )); RoboconfError def5 = new RoboconfError( ErrorCode.PROJ_NO_RESOURCE_DIRECTORY, component( "server" )); Assert.assertFalse( def4.equals( def5 )); Assert.assertFalse( def5.equals( def4 )); }
@Override public boolean equals( Object obj ) { return obj != null && obj.getClass().equals( getClass()) && Objects.equals( this.errorCode, ((RoboconfError) obj).errorCode ) && Arrays.deepEquals( this.details, ((RoboconfError) obj).details ); }
RoboconfError { @Override public boolean equals( Object obj ) { return obj != null && obj.getClass().equals( getClass()) && Objects.equals( this.errorCode, ((RoboconfError) obj).errorCode ) && Arrays.deepEquals( this.details, ((RoboconfError) obj).details ); } }
RoboconfError { @Override public boolean equals( Object obj ) { return obj != null && obj.getClass().equals( getClass()) && Objects.equals( this.errorCode, ((RoboconfError) obj).errorCode ) && Arrays.deepEquals( this.details, ((RoboconfError) obj).details ); } RoboconfError( ErrorCode errorCode );  RoboconfError( ErrorCode errorCode, ErrorDetails... details ); }
RoboconfError { @Override public boolean equals( Object obj ) { return obj != null && obj.getClass().equals( getClass()) && Objects.equals( this.errorCode, ((RoboconfError) obj).errorCode ) && Arrays.deepEquals( this.details, ((RoboconfError) obj).details ); } RoboconfError( ErrorCode errorCode );  RoboconfError( ErrorCode errorCode, ErrorDetails... details ); ErrorCode getErrorCode(); void setErrorCode( ErrorCode errorCode ); ErrorDetails[] getDetails(); void setDetails( ErrorDetails... details ); @Override String toString(); @Override boolean equals( Object obj ); @Override int hashCode(); }
RoboconfError { @Override public boolean equals( Object obj ) { return obj != null && obj.getClass().equals( getClass()) && Objects.equals( this.errorCode, ((RoboconfError) obj).errorCode ) && Arrays.deepEquals( this.details, ((RoboconfError) obj).details ); } RoboconfError( ErrorCode errorCode );  RoboconfError( ErrorCode errorCode, ErrorDetails... details ); ErrorCode getErrorCode(); void setErrorCode( ErrorCode errorCode ); ErrorDetails[] getDetails(); void setDetails( ErrorDetails... details ); @Override String toString(); @Override boolean equals( Object obj ); @Override int hashCode();  }