Fix unit tests for Java 7