Fix unit test on Java 7