@Test
  public void showsRemovedRelationships() throws Exception {
    // Given
    state.relationshipDoDelete(1l, 1, 1l, 2l);
    state.relationshipDoDelete(2l, 1, 1l, 1l);

    when(ops.relationshipGetAllProperties(1l))
        .thenReturn(IteratorUtil.<DefinedProperty>emptyIterator());
    when(ops.relationshipGetAllProperties(2l))
        .thenReturn(asList(Property.stringProperty(1, "p")).iterator());
    when(ops.propertyKeyGetName(1)).thenReturn("key");

    // When & Then
    TxStateTransactionDataSnapshot snapshot = snapshot();
    assertThat(idList(snapshot.deletedRelationships()), equalTo(asList(1l, 2l)));
    assertThat(single(snapshot.removedRelationshipProperties()).key(), equalTo("key"));
  }
 @Override
 public Iterator<DefinedProperty> relationshipGetAllProperties(
     KernelStatement state, long relationshipId) throws EntityNotFoundException {
   if (state.hasTxStateWithChanges()) {
     if (state.txState().relationshipIsAddedInThisTx(relationshipId)) {
       return state.txState().addedAndChangedRelationshipProperties(relationshipId);
     }
     if (state.txState().relationshipIsDeletedInThisTx(relationshipId)) {
       // TODO Throw IllegalStateException to conform with beans API. We may want to introduce
       // EntityDeletedException instead and use it instead of returning empty values in similar
       // places
       throw new IllegalStateException("Relationship " + relationshipId + " has been deleted");
     }
     return state
         .txState()
         .augmentRelationshipProperties(
             relationshipId, storeLayer.relationshipGetAllProperties(relationshipId));
   } else {
     return storeLayer.relationshipGetAllProperties(relationshipId);
   }
 }
  @Test
  public void correctlySaysRelIsDeleted() throws Exception {
    // Given
    state.relationshipDoDelete(1l, 1, 1l, 2l);

    Relationship rel = mock(Relationship.class);
    when(rel.getId()).thenReturn(1l);
    when(ops.relationshipGetAllProperties(1l))
        .thenReturn(Collections.<DefinedProperty>emptyIterator());

    // When & Then
    assertThat(snapshot().isDeleted(rel), equalTo(true));
  }