### Question:
SchemaSource { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SchemaSource other = (SchemaSource) obj; if (other.getSource() == null) { return false; } else if (!source.getSystemId().equals(other.source.getSystemId())) { return false; } return true; } SchemaSource(final InputStream inputStream, final String systemId); Source getSource(); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj);  }### Answer:
@Test public void equalsIsSymmetric() { final SchemaSource schemaSource2 = new SchemaSource(INPUT_STREAM, SYSTEM_ID); assertTrue("Equals is not symmetric", schemaSource.equals(schemaSource2) && schemaSource2.equals(schemaSource)); }
@Test public void equalsIsTransitive() { final SchemaSource schemaSource2 = new SchemaSource(INPUT_STREAM, SYSTEM_ID); final SchemaSource schemaSource3 = new SchemaSource(INPUT_STREAM, SYSTEM_ID); assertTrue("Equals is not transitive", schemaSource.equals(schemaSource2) && schemaSource2.equals(schemaSource3) && schemaSource.equals(schemaSource3)); }
@Test public void equalsIsCautious() { assertFalse("Comparison with null should always return false", schemaSource.equals(null)); }
@Test public void equalsIsTypeAware() { assertFalse("Comparison with different type should always return false", schemaSource.equals(this)); }
@Test public void equalsConsiderSchemaSource() { final SchemaSource schemaSource2 = new SchemaSource(INPUT_STREAM, "another id"); assertFalse("Schema source is not considered by equals", schemaSource.equals(schemaSource2)); }