Fix randomly failing test.

The test was depending on preserving the order of elements in non-preserving
collection implementation (set over the keys of live map). When the instantiated
entities have the same creation time there isn't determinism in picking one of them.
Make the test non-dependant on the insertion order.