Added query to the unit test

Unit tests for fetching data from database.