### Question:
ReadBlockOfChildrenRequest extends CacheableRequest { @Override public boolean equals( Object obj ) { if (obj == this) return true; if (this.getClass().isInstance(obj)) { ReadBlockOfChildrenRequest that = (ReadBlockOfChildrenRequest)obj; if (!this.of().isSame(that.of())) return false; if (this.startingAtIndex() != that.startingAtIndex()) return false; if (this.count() != that.count()) return false; if (!this.inWorkspace().equals(that.inWorkspace())) return false; return true; } return false; } ReadBlockOfChildrenRequest( Location of,
                                       String workspaceName,
                                       int startingIndex,
                                       int count ); @Override boolean isReadOnly(); Location of(); String inWorkspace(); int count(); int startingAtIndex(); int endingBefore(); List<Location> getChildren(); void addChildren( Iterable<Location> children ); void addChild( Location child ); void addChild( Path pathToChild,
                          Property firstIdProperty,
                          Property... remainingIdProperties ); void addChild( Path pathToChild,
                          Property idProperty ); void setActualLocationOfNode( Location actual ); Location getActualLocationOfNode(); @Override void cancel(); @Override int hashCode(); @Override boolean equals( Object obj ); @Override String toString(); @Override RequestType getType(); static final int INDEX_NOT_USED; }### Answer:
@Test public void shouldConsiderNotEqualTwoRequestsWithDifferentLocations() { request = new ReadBlockOfChildrenRequest(validPathLocation1, workspace1, 20, 20); ReadBlockOfChildrenRequest request2 = new ReadBlockOfChildrenRequest(validPathLocation2, workspace1, 2, 20); assertThat(request.equals(request2), is(false)); }
@Test public void shouldConsiderNotEqualTwoRequestsWithDifferentWorkspaceNames() { request = new ReadBlockOfChildrenRequest(validPathLocation1, workspace1, 20, 20); ReadBlockOfChildrenRequest request2 = new ReadBlockOfChildrenRequest(validPathLocation1, workspace2, 2, 20); assertThat(request.equals(request2), is(false)); }
@Test public void shouldConsiderNotEqualTwoRequestsWithSameLocationsButDifferentStartingIndexes() { request = new ReadBlockOfChildrenRequest(validPathLocation1, workspace1, 20, 20); ReadBlockOfChildrenRequest request2 = new ReadBlockOfChildrenRequest(validPathLocation1, workspace1, 2, 20); assertThat(request.equals(request2), is(false)); }
@Test public void shouldConsiderNotEqualTwoRequestsWithSameLocationsButDifferentBlockSizes() { request = new ReadBlockOfChildrenRequest(validPathLocation1, workspace1, 2, 2); ReadBlockOfChildrenRequest request2 = new ReadBlockOfChildrenRequest(validPathLocation1, workspace1, 2, 20); assertThat(request.equals(request2), is(false)); }