Add an exception handling for methods with invalid arguments and its test.