### Question:
BasicPathSegment implements Path.Segment { @Override public boolean equals( Object obj ) { if (obj == this) return true; if (obj instanceof Path.Segment) { Path.Segment that = (Path.Segment)obj; if (!this.getName().equals(that.getName())) return false; return Math.abs(getIndex()) == Math.abs(that.getIndex()); } return false; } BasicPathSegment( Name name );  BasicPathSegment( Name name,
                             int index ); int getIndex(); Name getName(); boolean hasIndex(); boolean isParentReference(); boolean isSelfReference(); boolean isIdentifier(); int compareTo( Path.Segment that ); @Override int hashCode(); @Override boolean equals( Object obj ); @Override String toString(); String getUnencodedString(); String getString(); String getString( TextEncoder encoder ); String getString( NamespaceRegistry namespaceRegistry ); String getString( NamespaceRegistry namespaceRegistry,
                             TextEncoder encoder ); String getString( NamespaceRegistry namespaceRegistry,
                             TextEncoder encoder,
                             TextEncoder delimiterEncoder );  }### Answer:
@Test public void shouldConsiderSegmentCreatedWithSelfReferenceToBeEqualToStaticSingleton() { segment = factory.createSegment(Path.SELF); assertThat(segment.equals(Path.SELF_SEGMENT), is(true)); }
@Test public void shouldConsiderSegmentCreatedWithParentReferenceToBeEqualToStaticSingleton() { segment = factory.createSegment(Path.PARENT); assertThat(segment.equals(Path.PARENT_SEGMENT), is(true)); }