Fix bugs in test (revealed by Java 8), where the insertion order to HashMap is not guaranteed