fixing the tests exception handling and readability