use of org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator in project neo4j by neo4j.
the class NodeRecordTest method shouldToStringBothUsedAndUnusedDynamicLabelRecords.
@Test
public void shouldToStringBothUsedAndUnusedDynamicLabelRecords() throws Exception {
// GIVEN
IdSequence ids = mock(IdSequence.class);
when(ids.nextId()).thenReturn(1L, 2L);
ReusableRecordsAllocator recordAllocator = new ReusableRecordsAllocator(30, new DynamicRecord(1), new DynamicRecord(2));
NodeRecord node = newUsedNodeRecord(0);
long labelId = 10_123;
// A dynamic label record
Collection<DynamicRecord> existing = allocateRecordsForDynamicLabels(node.getId(), new long[] { labelId }, recordAllocator);
// and a deleted one as well (simulating some deleted labels)
DynamicRecord unused = newDeletedDynamicRecord(ids.nextId());
unused.setInUse(false);
existing.add(unused);
node.setLabelField(dynamicPointer(existing), existing);
// WHEN
String toString = node.toString();
// THEN
assertThat(toString, containsString(String.valueOf(labelId)));
assertThat(toString, containsString(unused.toString()));
}
Aggregations