Added unit tests for the java code.