Add tests for error conditions