Adding tests for error handling semantics before refactor