### Question:
NodeStore extends CommonAbstractStore<NodeRecord,NoStoreHeader> { public static Long readOwnerFromDynamicLabelsRecord( DynamicRecord record ) { byte[] data = record.getData(); byte[] header = PropertyType.ARRAY.readDynamicRecordHeader( data ); byte[] array = Arrays.copyOfRange( data, header.length, data.length ); int requiredBits = header[2]; if ( requiredBits == 0 ) { return null; } Bits bits = Bits.bitsFromBytes( array ); return bits.getLong( requiredBits ); } NodeStore(
            File file,
            File idFile,
            Config config,
            IdGeneratorFactory idGeneratorFactory,
            PageCache pageCache,
            LogProvider logProvider,
            DynamicArrayStore dynamicLabelStore,
            RecordFormats recordFormats,
            OpenOption... openOptions ); static Long readOwnerFromDynamicLabelsRecord( DynamicRecord record ); @Override void accept( Processor<FAILURE> processor, NodeRecord record ); @Override void ensureHeavy( NodeRecord node ); void ensureHeavy( NodeRecord node, long firstDynamicLabelRecord ); @Override void updateRecord( NodeRecord record ); DynamicArrayStore getDynamicLabelStore(); void updateDynamicLabelRecords( Iterable<DynamicRecord> dynamicLabelRecords ); static final String TYPE_DESCRIPTOR; }### Answer:
@Test public void shouldReadFirstFromSingleRecordDynamicLongArray() { Long expectedId = 12L; long[] ids = new long[]{expectedId, 23L, 42L}; DynamicRecord firstRecord = new DynamicRecord( 0L ); allocateFromNumbers( new ArrayList<>(), ids, new ReusableRecordsAllocator( 60, firstRecord ) ); Long firstId = readOwnerFromDynamicLabelsRecord( firstRecord ); assertEquals( expectedId, firstId ); }
@Test public void shouldReadFirstAsNullFromEmptyDynamicLongArray() { Long expectedId = null; long[] ids = new long[]{}; DynamicRecord firstRecord = new DynamicRecord( 0L ); allocateFromNumbers( new ArrayList<>(), ids, new ReusableRecordsAllocator( 60, firstRecord ) ); Long firstId = readOwnerFromDynamicLabelsRecord( firstRecord ); assertEquals( expectedId, firstId ); }
@Test public void shouldReadFirstFromTwoRecordDynamicLongArray() { Long expectedId = 12L; long[] ids = new long[]{expectedId, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L}; DynamicRecord firstRecord = new DynamicRecord( 0L ); allocateFromNumbers( new ArrayList<>(), ids, new ReusableRecordsAllocator( 8, firstRecord, new DynamicRecord( 1L ) ) ); Long firstId = readOwnerFromDynamicLabelsRecord( firstRecord ); assertEquals( expectedId, firstId ); }