Moved tests to scala and added tests for db