added unit test, and check for java > 1.7