### Question:
LoggingObject implements ILoggingObject { @Override public boolean equals( Object obj ) { if ( !( obj instanceof LoggingObject ) ) { return false; } if ( obj == this ) { return true; } try { LoggingObject loggingObject = (LoggingObject) obj; boolean sameCarteFamily = ( getContainerId() == null && loggingObject.getContainerId() == null ) || ( getContainerId() != null && loggingObject.getContainerId() != null && getContainerId() .equals( loggingObject.getContainerId() ) ); boolean sameParents = loggingObject.getParent() == null && this.getParent() == null || loggingObject.getParent() != null && this.getParent() != null && loggingObject.getParent().equals( this.getParent() ); if ( sameCarteFamily && !Utils.isEmpty( loggingObject.getFilename() ) && loggingObject.getFilename().equals( getFilename() ) && sameParents && StringUtils.equals( loggingObject.getObjectName(), getObjectName() ) ) { return true; } if ( !sameCarteFamily || ( loggingObject.getObjectName() == null && getObjectName() != null ) || ( loggingObject.getObjectName() != null && getObjectName() == null ) ) { return false; } if ( sameCarteFamily && ( ( loggingObject.getObjectName() == null && getObjectName() == null ) || ( loggingObject .getObjectName().equals( getObjectName() ) ) ) && loggingObject.getObjectType().equals( getObjectType() ) ) { if ( !Utils.isEmpty( getObjectCopy() ) && !getObjectCopy().equals( loggingObject.getObjectCopy() ) ) { return false; } ILoggingObject parent1 = loggingObject.getParent(); ILoggingObject parent2 = getParent(); if ( ( parent1 != null && parent2 == null ) || ( parent1 == null && parent2 != null ) ) { return false; } if ( parent1 == null && parent2 == null ) { return true; } if ( parent1.equals( parent2 ) ) { return true; } } } catch ( Exception e ) { e.printStackTrace(); } return false; } LoggingObject( Object object ); @Override boolean equals( Object obj ); @Override String getObjectName(); void setObjectName( String name ); @Override String getFilename(); void setFilename( String filename ); @Override String getLogChannelId(); void setLogChannelId( String logChannelId ); @Override ILoggingObject getParent(); void setParent( ILoggingObject parent ); @Override LoggingObjectType getObjectType(); void setObjectType( LoggingObjectType objectType ); @Override String getObjectCopy(); void setObjectCopy( String objectCopy ); @Override LogLevel getLogLevel(); void setLogLevel( LogLevel logLevel ); @Override String getContainerId(); void setCarteObjectId( String serverObjectId ); @Override Date getRegistrationDate(); void setRegistrationDate( Date registrationDate ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging );  }### Answer:
@Test public void testEquals() throws Exception { ILoggingObject parent = new LoggingObject( new SimpleLoggingObject( "parent", LoggingObjectType.WORKFLOW, null ) ); LoggingObject loggingObject1 = new LoggingObject( "test" ); loggingObject1.setFilename( "fileName" ); loggingObject1.setParent( parent ); loggingObject1.setObjectName( "job1" ); LoggingObject loggingObject2 = new LoggingObject( "test" ); loggingObject2.setFilename( "fileName" ); loggingObject2.setParent( parent ); loggingObject2.setObjectName( "job2" ); Assert.assertFalse( loggingObject1.equals( loggingObject2 ) ); }