I have a class DBHandler which takes a query, runs it through the SQL server, checks for errors and returns the result. How can I unit test this class?
DBHandler
Just pass a SQL query, and compare the returned result to expected result. Simple. JUnit is a unit test framework, you can utilise that.
For sophisticated database unit testing, look at DBUnit.