Fix a non-deterministic test on Java 6