Unit tests for error checking