Remove untested and never-executable code, remove not used exception, fix the expected exception type