-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update module error message and 2 suffix allowance #240
Update module error message and 2 suffix allowance #240
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! minor nits
@@ -11,8 +11,8 @@ public class Module { | |||
|
|||
|
|||
public static final String MESSAGE_CONSTRAINTS = | |||
"Module code should contain 2-4 capital letters followed by 4 digits long and at most 1 capitalised suffix"; | |||
public static final String VALIDATION_REGEX = "[a-zA-Z]{2,4}\\d{4}[a-zA-Z]{0,1}"; | |||
"Module code should contain 2-4 letters followed by 4 digits long and at most 2 capitalised suffix"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be and suffix of at most 2 characters
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amended 🔧
assertTrue(Module.isValidModule("CS2103")); // 2 prefix, 4 letters without 1 optional suffix | ||
assertTrue(Module.isValidModule("CS2103T")); // 2 prefix, 4 letters with 1 optional suffix | ||
assertTrue(Module.isValidModule("CS2103TT")); // 2 prefix, 4 letters with 2 optional suffix | ||
assertTrue(Module.isValidModule("GEN2050")); // 3 prefix, 4 letters without 1 optional suffix | ||
assertTrue(Module.isValidModule("GEN2050Y")); // 3 prefix, 4 letters with 1 optional suffix | ||
assertTrue(Module.isValidModule("GESS1035")); // 4 prefix, 4 letters without 1 optional suffix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Misleading comment 4 letters
-> 4 digits
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amended 🔧
Plausible module:
ASP1201CH
--> Increase suffix allowed to increase scope for valid inputs
Closes #235