The assignment includes use of try-catch in Java. Unfortunately, in this case, it's unclear how the program (or at least the constructor for AccessibilityTests) should proceed if the filename from which the data for analysis will be read is problematic. This might arguably be a wrong time to catch an exception since the constructor doesn't really have sufficient information to change the course of action or recover. Since exception-handling is a likely learning objective for a course in which this assignment would be appropriate, it seems slightly more problematic than just (e.g.) demonstrating to students that sometimes we may not follow best practices in real code.
Consider changing the assignment to say to use try-catch instead to handle an error in parsing a line of the file. E.g. if any line in the file has > 2 words but < 6 (the theoretical minimum to have a category, 4 test result values, and a description), use catch to construct an AccessibilityTest that has as its category the first word on the line, has as its description the remaining (1-3) word(s) on the line, and error as the result of all 4 tests.
The assignment includes use of try-catch in Java. Unfortunately, in this case, it's unclear how the program (or at least the constructor for
AccessibilityTests) should proceed if thefilenamefrom which the data for analysis will be read is problematic. This might arguably be a wrong time to catch an exception since the constructor doesn't really have sufficient information to change the course of action or recover. Since exception-handling is a likely learning objective for a course in which this assignment would be appropriate, it seems slightly more problematic than just (e.g.) demonstrating to students that sometimes we may not follow best practices in real code.Consider changing the assignment to say to use try-catch instead to handle an error in parsing a line of the file. E.g. if any line in the file has > 2 words but < 6 (the theoretical minimum to have a category, 4 test result values, and a description), use
catchto construct anAccessibilityTestthat has as its category the first word on the line, has as itsdescriptionthe remaining (1-3) word(s) on the line, anderroras the result of all 4 tests.