Suppose you were asked to test some code for possible issues handling exceptions. Describe briefly how you would go about testing to see if your code was exception-safe.
Most of the test cases are written considering the upper and lower limits of the loops or the conditions of if else statements.
In whitebox testing, user can see the code and write test cases accordingly by checking the boundary conditions.
The testing should also consider the conditions that are handled in case null values come up in the processing of strings, int etc.
Input Output files exception handling is done when there is interaction of code and files on system.
If there is any division of a variable, then Arithmetic Exceptions need to be checked.
In case, if Array is used then Array Index should be checked if the code process array data.
There are many other pre defined Exceptions that can be handled in java. Also java gives us the option to explicitly throw Exception if we want to create a self defined Exception and handle it own way.
Get Answers For Free
Most questions answered within 1 hours.