Added unit tests and fixed a gradle issue for unit testing.