Make tests pass with java 7

This PR fix the issue #953 and make the project testable with java 7.