Refactored tests to work with jdk from 5 to 8