Add unit tests for getConnection function