[Added] JUnit tests for database
[Refactoring]