@Test
  public void shouldProvideFirstRelationshipIdsOfDenseNode() throws Exception {
    // GIVEN
    ControlledLoaders fakeStore = new ControlledLoaders();
    long nodeId = 2L;
    int firstType = 1, secondType = 2;
    long firstGroupId = 5L;
    long firstGroupOut = 10, firstGroupIn = -1, firstGroupLoop = 7;
    long secondGroupId = 7L;
    long secondGroupOut = -1, secondGroupIn = 20, secondGroupLoop = 22;
    fakeStore.getNodes().put(nodeId, new NodeRecord(nodeId, true, firstGroupId, -1, true));
    fakeStore
        .getRelationshipGroups()
        .put(
            firstGroupId,
            new RelationshipGroupRecord(
                firstGroupId,
                firstType,
                firstGroupOut,
                firstGroupIn,
                firstGroupLoop,
                nodeId,
                secondGroupId,
                true));
    fakeStore
        .getRelationshipGroups()
        .put(
            secondGroupId,
            new RelationshipGroupRecord(
                secondGroupId,
                secondType,
                secondGroupOut,
                secondGroupIn,
                secondGroupLoop,
                nodeId,
                true));
    RecordStateForCacheAccessor accessor =
        new RecordStateForCacheAccessor(fakeStore.newAccessSet());

    // WHEN
    FirstRelationshipIds firstIds = accessor.firstRelationshipIdsOf(nodeId);

    // THEN
    assertEquals(firstGroupOut, firstIds.firstIdOf(firstType, DirectionWrapper.OUTGOING));
    assertEquals(firstGroupIn, firstIds.firstIdOf(firstType, DirectionWrapper.INCOMING));
    assertEquals(firstGroupLoop, firstIds.firstIdOf(firstType, DirectionWrapper.BOTH));
    assertEquals(secondGroupOut, firstIds.firstIdOf(secondType, DirectionWrapper.OUTGOING));
    assertEquals(secondGroupIn, firstIds.firstIdOf(secondType, DirectionWrapper.INCOMING));
    assertEquals(secondGroupLoop, firstIds.firstIdOf(secondType, DirectionWrapper.BOTH));
  }
  @Test
  public void shouldProvideFirstRelationshipIdOfSparseNode() throws Exception {
    // GIVEN
    ControlledLoaders fakeStore = new ControlledLoaders();
    long nodeId = 0L, relId = 3L;
    fakeStore.getNodes().put(nodeId, new NodeRecord(nodeId, false, relId, -1, true));
    fakeStore
        .getRelationships()
        .put(relId, new RelationshipRecord(relId, true, 0, 0, 0, -1, -1, -1, -1, true, true));
    RecordStateForCacheAccessor accessor =
        new RecordStateForCacheAccessor(fakeStore.newAccessSet());

    // WHEN
    FirstRelationshipIds firstIds = accessor.firstRelationshipIdsOf(nodeId);

    // THEN
    assertEquals(relId, firstIds.firstIdOf(0, DirectionWrapper.OUTGOING));
    assertEquals(relId, firstIds.firstIdOf(2, DirectionWrapper.BOTH));
  }