Fix tests in JDK8