### Question:
OwnerCheck implements CheckDecorator { RecordCheck<DynamicRecord, DynamicConsistencyReport> decorateDynamicChecker( final RecordType type, final RecordCheck<DynamicRecord, DynamicConsistencyReport> checker ) { final ConcurrentMap<Long, DynamicOwner> dynamicOwners = dynamicOwners( type ); if ( dynamicOwners == null ) { return checker; } return ( record, engine, records ) -> { if ( record.inUse() ) { DynamicOwner.Unknown owner = new DynamicOwner.Unknown(); engine.comparativeCheck( owner, DynamicOwner.ORPHAN_CHECK ); if ( null == dynamicOwners.putIfAbsent( record.getId(), owner ) ) { owner.markInCustody(); } if ( !Record.NO_NEXT_BLOCK.is( record.getNextBlock() ) ) { DynamicOwner.Dynamic nextOwner = new DynamicOwner.Dynamic( type, record ); DynamicOwner prevOwner = dynamicOwners.put( record.getNextBlock(), nextOwner ); if ( prevOwner != null ) { engine.comparativeCheck( prevOwner.record( records ), nextOwner ); } } } checker.check( record, engine, records ); }; } 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 shouldReportDynamicRecordOwnedByTwoOtherDynamicRecords() { RecordAccessStub records = new RecordAccessStub(); OwnerCheck decorator = new OwnerCheck( true, DynamicStore.STRING ); RecordCheck<DynamicRecord, ConsistencyReport.DynamicConsistencyReport> checker = decorator .decorateDynamicChecker( RecordType.STRING_PROPERTY, dummyDynamicCheck( configureDynamicStore( 50 ), DynamicStore.STRING ) ); DynamicRecord record1 = records.add( inUse( string( new DynamicRecord( 1 ) ) ) ); DynamicRecord record2 = records.add( inUse( string( new DynamicRecord( 2 ) ) ) ); DynamicRecord record3 = records.add( inUse( string( new DynamicRecord( 3 ) ) ) ); record1.setNextBlock( record3.getId() ); record2.setNextBlock( record3.getId() ); ConsistencyReport.DynamicConsistencyReport report1 = check( ConsistencyReport.DynamicConsistencyReport.class, checker, record1, records ); ConsistencyReport.DynamicConsistencyReport report2 = check( ConsistencyReport.DynamicConsistencyReport.class, checker, record2, records ); verifyNoMoreInteractions( report1 ); verify( report2 ).nextMultipleOwners( record1 ); verifyNoMoreInteractions( report2 ); }