added expect.exception method for code block