Write tests for throwing correct exceptions