use of org.neo4j.internal.batchimport.cache.idmapping.IdMapper in project neo4j by neo4j.
the class EncodingIdMapperTest method shouldHandleManyGroups.
@Test
public void shouldHandleManyGroups() {
// GIVEN
// which results in GLOBAL (0) + 1-256 = 257 groups, i.e. requiring two bytes
int size = 256;
for (int i = 0; i < size; i++) {
groups.getOrCreate("" + i);
}
IdMapper mapper = mapper(new LongEncoder(), Radix.LONG, EncodingIdMapper.NO_MONITOR);
// WHEN
for (int i = 0; i < size; i++) {
mapper.put(i, i, groups.get("" + i));
}
// null since this test should have been set up to not run into collisions
mapper.prepare(null, mock(Collector.class), NONE);
// THEN
for (int i = 0; i < size; i++) {
assertEquals(i, mapper.get(i, groups.get("" + i)));
}
}
Aggregations