Java Exception Handling (Try-catch)

  • + 0 comments

    Writing a test case that expects an exception thrown is a better approach than one that expects the exception message. I'm not very familiar with HackerRank so this may not be possible, but it's not a good practice to force the developer to catch an exception that was going to be thrown anyway for the sake of testing.