Open leslieyip02 opened 2 weeks ago
No details provided by team.
[The team marked this bug as a duplicate of the following bug]
Inconsistent view command error message for invalid indices
Description
When using an invalid index with the
view
command, the error messages are not consistent. When using an index that is greater than the size of the list of clients, the error message isThe Client index provided is invalid.
. When using indices such as 0 or -1, the error message isInvalid command format!
, which is less precise.Steps to Reproduce
view 0
Expected Result
[original: nus-cs2103-AY2425S1/pe-interim#784] [original labels: severity.Low type.FunctionalityBug]
[This is the team's response to the above 'original' bug]
Thank you for your feedback. However, this issue does not constitute a bug. Below is the rationale for rejecting this report:
Reason for duplication
The command's input validation for indices parsed when executing
view
,check
, anddel-client
are handled by the same methodParserUtil:parseIndex()
. In order for input validation handled by individual CommandsViewClientCommand
,CheckClientCommand
andDeleteClientCommand
, we can only "fix the defect" by changing theparseIndex
method to not throw theParseException
. However, our team still firmly believes that it is a better practice to handle such inputs (zero, negative) at theparseIndex
function and do not deem this as a defect, as it reduces unnecessary code repetition, as well as segregates issues caused by command format (e.g. zero/ negative integers) vs issues caused by other factors (e.g. client index does not exist in the list). In this case, as the index does not follow the command specifications (must be positive integer), we deem such inputs asInvalid command format!
. (more below)Reason for rejection (Please see Equivalence Partitions for more information)
NOTE: the context used here is
view
, but it applies to bothcheck
anddel-client
as well (see reason for duplication).As stated in the screenshots for
view 0
andview -1
and the UG, Parameters: INDEX (must be a positive integer), MATER thus behaved as expected, alerting the user that the format of the command is invalid due to an input of zero/ negative integer.In the case of
view 8
, MATER behaved as expected. The command format is correct as 8 is a positive integer. MATER then behaved as expected, correctly alerts the user that the index 8 provided is invalid as the client does not exist on the list.Equivalence Partitions
- [MIN_INT ... 0]:
Invalid command format!
due to input of zero/ negative integer, which goes against command specifications (must be a positive integer). Rejected by Parser as it is an issue with command format.- [1 ... N]: (where N = number of clients in the list) Successfully view client details.
- [N + 1 ... MAX_INT]:
The Client index provided is invalid.
as a client with the index does not exist on the list. However, the command format is still correct as it abides by the command specifications (must be a positive integer). Rejected by Command as it is an issue caused by factors other than command format.Screenshot of Error Message.
Error Message clearly states the command specifications, where integer must be positive.
Screenshot of UG.
UG clearly states the command specifications, where integer must be positive.
Items for the Tester to Verify
:question: Issue duplicate status
Team chose to mark this issue as a duplicate of another issue (as explained in the Team's response above)
Reason for disagreement: [replace this with your explanation]
Description
When using an invalid index with the
check
command, the error messages are not consistent. When using an index that is greater than the size of the list of clients, the error message isThe Client index provided is invalid.
. When using indices such as 0 or -1, the error message isInvalid command format!
, which is less precise.Steps to Reproduce
check 0
Expected Result