### Question:
OwnerCheck implements CheckDecorator { @Override public OwningRecordCheck<RelationshipRecord, RelationshipConsistencyReport> decorateRelationshipChecker( OwningRecordCheck<RelationshipRecord, RelationshipConsistencyReport> checker ) { if ( owners == null ) { return checker; } return new PrimitiveCheckerDecorator<RelationshipRecord, RelationshipConsistencyReport>( checker ) { @Override PropertyOwner owner( RelationshipRecord record ) { return new PropertyOwner.OwningRelationship( record ); } }; } OwnerCheck( boolean active, DynamicStore... stores ); @Override void prepare(); @Override OwningRecordCheck<NeoStoreRecord, NeoStoreConsistencyReport> decorateNeoStoreChecker(
            OwningRecordCheck<NeoStoreRecord, NeoStoreConsistencyReport> checker ); @Override OwningRecordCheck<NodeRecord, NodeConsistencyReport> decorateNodeChecker(
            OwningRecordCheck<NodeRecord, NodeConsistencyReport> checker ); @Override OwningRecordCheck<RelationshipRecord, RelationshipConsistencyReport> decorateRelationshipChecker(
            OwningRecordCheck<RelationshipRecord, RelationshipConsistencyReport> checker ); @Override RecordCheck<PropertyRecord, PropertyConsistencyReport> decoratePropertyChecker(
            final RecordCheck<PropertyRecord, PropertyConsistencyReport> checker ); @Override RecordCheck<PropertyKeyTokenRecord, PropertyKeyTokenConsistencyReport> decoratePropertyKeyTokenChecker(
            RecordCheck<PropertyKeyTokenRecord, PropertyKeyTokenConsistencyReport> checker ); @Override RecordCheck<RelationshipTypeTokenRecord,RelationshipTypeConsistencyReport> decorateRelationshipTypeTokenChecker(
            RecordCheck<RelationshipTypeTokenRecord,RelationshipTypeConsistencyReport> checker ); @Override RecordCheck<LabelTokenRecord, LabelTokenConsistencyReport> decorateLabelTokenChecker(
            RecordCheck<LabelTokenRecord, LabelTokenConsistencyReport> checker ); @Override RecordCheck<RelationshipGroupRecord, RelationshipGroupConsistencyReport> decorateRelationshipGroupChecker(
            RecordCheck<RelationshipGroupRecord, RelationshipGroupConsistencyReport> checker );  }### Answer:
@Test void shouldNotReportAnythingForRelationshipsWithDifferentPropertyChains() { OwnerCheck decorator = new OwnerCheck( true ); RecordCheck<RelationshipRecord, ConsistencyReport.RelationshipConsistencyReport> relationshipChecker = decorator.decorateRelationshipChecker( dummyRelationshipChecker() ); RecordAccessStub records = new RecordAccessStub(); RelationshipRecord relationship1 = records.add( inUse( new RelationshipRecord( 1, 0, 1, 0 ) ) ); relationship1.setNextProp( 7 ); RelationshipRecord relationship2 = records.add( inUse( new RelationshipRecord( 2, 0, 1, 0 ) ) ); relationship2.setNextProp( 8 ); ConsistencyReport.RelationshipConsistencyReport report1 = check( ConsistencyReport.RelationshipConsistencyReport.class, relationshipChecker, relationship1, records ); ConsistencyReport.RelationshipConsistencyReport report2 = check( ConsistencyReport.RelationshipConsistencyReport.class, relationshipChecker, relationship2, records ); verifyZeroInteractions( report1 ); verifyZeroInteractions( report2 ); }
@Test void shouldReportTwoRelationshipsWithSamePropertyChain() { OwnerCheck decorator = new OwnerCheck( true ); RecordCheck<RelationshipRecord, ConsistencyReport.RelationshipConsistencyReport> relationshipChecker = decorator.decorateRelationshipChecker( dummyRelationshipChecker() ); RecordAccessStub records = new RecordAccessStub(); RelationshipRecord relationship1 = records.add( inUse( new RelationshipRecord( 1, 0, 1, 0 ) ) ); relationship1.setNextProp( 7 ); RelationshipRecord relationship2 = records.add( inUse( new RelationshipRecord( 2, 0, 1, 0 ) ) ); relationship2.setNextProp( relationship1.getNextProp() ); ConsistencyReport.RelationshipConsistencyReport report1 = check( ConsistencyReport.RelationshipConsistencyReport.class, relationshipChecker, relationship1, records ); ConsistencyReport.RelationshipConsistencyReport report2 = check( ConsistencyReport.RelationshipConsistencyReport.class, relationshipChecker, relationship2, records ); verifyZeroInteractions( report1 ); verify( report2 ).multipleOwners( relationship1 ); }