Extract test cases

- Convert parts that raise errors into separate test cases