### Question:
NodeDynamicLabelOrphanChainStartCheck implements RecordCheck<DynamicRecord, DynamicLabelConsistencyReport>,
        ComparativeRecordChecker<DynamicRecord, DynamicRecord, DynamicLabelConsistencyReport> { @Override public void check( DynamicRecord record, CheckerEngine<DynamicRecord, DynamicLabelConsistencyReport> engine, RecordAccess records ) { if ( record.inUse() && record.isStartRecord() ) { Long ownerId = readOwnerFromDynamicLabelsRecord( record ); if ( null == ownerId ) { engine.report().orphanDynamicLabelRecord(); } else { engine.comparativeCheck( records.node( ownerId ), VALID_NODE_RECORD ); } } }  @Override void check( DynamicRecord record,
                       CheckerEngine<DynamicRecord, DynamicLabelConsistencyReport> engine,
                       RecordAccess records ); @Override void checkReference( DynamicRecord record, DynamicRecord record2,
                                CheckerEngine<DynamicRecord, DynamicLabelConsistencyReport> engine,
                                RecordAccess records );  }### Answer:
@Test void shouldReportMissingOwnerId() { DynamicRecord record = new DynamicRecord( 0 ); inUse( record ) ; allocateFromNumbers( new ArrayList<>(), new long[] { }, new ReusableRecordsAllocator( 66, record ) ); DynamicLabelConsistencyReport report = check( record ); verify( report ).orphanDynamicLabelRecord(); }
@Test void shouldReportOwningNodeRecordNotInUse() { NodeRecord nodeRecord = notInUse( new NodeRecord( 12L, false, -1, -1 ) ); add( nodeRecord ); DynamicRecord nodeDynamicLabelRecord = inUse( new DynamicRecord( 0 ) ); allocateFromNumbers( new ArrayList<>(), new long[]{12L}, new ReusableRecordsAllocator( 66, nodeDynamicLabelRecord ) ); DynamicLabelConsistencyReport report = check( nodeDynamicLabelRecord ); verify( report ).orphanDynamicLabelRecordDueToInvalidOwner( nodeRecord ); }
@Test void shouldReportOwningNodeRecordNotPointingBack() { long nodeId = 12L; Collection<DynamicRecord> validLabelRecords = new ArrayList<>(); DynamicRecord dynamicRecord = inUse( new DynamicRecord( 0 ) ); allocateFromNumbers( validLabelRecords, new long[] {nodeId}, new ReusableRecordsAllocator( 66, dynamicRecord ) ); Collection<DynamicRecord> fakePointedToRecords = new ArrayList<>(); DynamicRecord dynamicRecord1 = inUse( new DynamicRecord( 1 ) ); allocateFromNumbers( fakePointedToRecords, new long[] {nodeId}, new ReusableRecordsAllocator( 66, dynamicRecord1 ) ); NodeRecord nodeRecord = inUse( new NodeRecord( nodeId, false, -1, -1 ) ); nodeRecord.setLabelField( dynamicPointer( fakePointedToRecords ), fakePointedToRecords ); add( nodeRecord ); DynamicLabelConsistencyReport report = check( Iterators.single( validLabelRecords.iterator() ) ); verify( report ).orphanDynamicLabelRecordDueToInvalidOwner( nodeRecord ); }