private static void AssertQueryResultsMatch(ScoreEntityIterator result, long[] ids)
        {
            PrimitiveLongSet set = PrimitiveLongCollections.setOf(ids);

            while (result.MoveNext())
            {
                long next = result.Current.entityId();
                assertTrue(format("Result returned node id %d, expected one of %s", next, Arrays.ToString(ids)), set.Remove(next));
            }
            if (!set.Empty)
            {
                IList <long> list = new List <long>();
                set.VisitKeys(k => !list.Add(k));
                fail("Number of results differ from expected. " + set.Size() + " IDs were not found in the result: " + list);
            }
        }
        private static void AssertQueryResultsMatchInOrder(ScoreEntityIterator result, long[] ids)
        {
            int   num   = 0;
            float score = float.MaxValue;

            while (result.MoveNext())
            {
                ScoreEntityIterator.ScoreEntry scoredResult = result.Current;
                long  nextId    = scoredResult.EntityId();
                float nextScore = scoredResult.Score();
                assertThat(nextScore, lessThanOrEqualTo(score));
                score = nextScore;
                assertEquals(format("Result returned node id %d, expected %d", nextId, ids[num]), ids[num], nextId);
                num++;
            }
            assertEquals("Number of results differ from expected", ids.Length, num);
        }