Fix tests for Java 7