-
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
Add test to student #160
Add test to student #160
Conversation
Codecov Report
@@ Coverage Diff @@
## master #160 +/- ##
============================================
+ Coverage 28.25% 30.38% +2.12%
- Complexity 378 425 +47
============================================
Files 123 126 +3
Lines 3221 3229 +8
Branches 367 370 +3
============================================
+ Hits 910 981 +71
+ Misses 2212 2151 -61
+ Partials 99 97 -2
|
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!
this.sid = sid; | ||
} | ||
|
||
/** | ||
* Returns true if a given string is a valid name. | ||
*/ | ||
public static boolean isValidName(String test) { | ||
public static boolean isValidSid(String test) { |
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.
I like how you rename the variable name !
assertFalse(StudentEmail.isValidEmail("")); // empty string | ||
assertFalse(StudentEmail.isValidEmail(" ")); // spaces only | ||
|
||
// missing parts | ||
assertFalse(StudentEmail.isValidEmail("@example.com")); // missing local part | ||
assertFalse(StudentEmail.isValidEmail("peterjackexample.com")); // missing '@' symbol | ||
assertFalse(StudentEmail.isValidEmail("peterjack@")); // missing domain name | ||
|
||
// invalid parts | ||
assertFalse(StudentEmail.isValidEmail("peterjack@-")); // invalid domain name | ||
assertFalse(StudentEmail.isValidEmail("peterjack@exam_ple.com")); // underscore in domain name | ||
assertFalse(StudentEmail.isValidEmail("peter [email protected]")); // spaces in local part | ||
assertFalse(StudentEmail.isValidEmail("peterjack@exam ple.com")); // spaces in domain name | ||
assertFalse(StudentEmail.isValidEmail(" [email protected]")); // leading space | ||
assertFalse(StudentEmail.isValidEmail("[email protected] ")); // trailing space | ||
assertFalse(StudentEmail.isValidEmail("peterjack@@example.com")); // double '@' symbol | ||
assertFalse(StudentEmail.isValidEmail("peter@[email protected]")); // '@' symbol in local part | ||
assertFalse(StudentEmail.isValidEmail("[email protected]")); // local part starts with a hyphen | ||
assertFalse(StudentEmail.isValidEmail("[email protected]")); // local part ends with a hyphen | ||
assertFalse(StudentEmail.isValidEmail("[email protected]")); // local part has two consecutive periods | ||
assertFalse(StudentEmail.isValidEmail("peterjack@example@com")); // '@' symbol in domain name | ||
assertFalse(StudentEmail.isValidEmail("[email protected]")); // domain name starts with a period | ||
assertFalse(StudentEmail.isValidEmail("[email protected].")); // domain name ends with a period | ||
assertFalse(StudentEmail.isValidEmail("[email protected]")); // domain name starts with a hyphen | ||
assertFalse(StudentEmail.isValidEmail("[email protected]")); // domain name ends with a hyphen | ||
assertFalse(StudentEmail.isValidEmail("[email protected]")); // top level domain has less than two chars | ||
|
||
// valid email | ||
assertTrue(StudentEmail.isValidEmail("[email protected]")); // underscore in local part | ||
assertTrue(StudentEmail.isValidEmail("[email protected]")); // period in local part | ||
assertTrue(StudentEmail.isValidEmail("[email protected]")); // '+' symbol in local part | ||
assertTrue(StudentEmail.isValidEmail("[email protected]")); // hyphen in local part | ||
assertTrue(StudentEmail.isValidEmail("a@bc")); // minimal | ||
assertTrue(StudentEmail.isValidEmail("test@localhost")); // alphabets only | ||
assertTrue(StudentEmail.isValidEmail("123@145")); // numeric local part and domain name | ||
assertTrue(StudentEmail.isValidEmail("[email protected]")); // mixture of alphanumeric and special characters | ||
assertTrue(StudentEmail.isValidEmail("[email protected]")); // long domain name | ||
assertTrue(StudentEmail.isValidEmail("[email protected]")); // long local part | ||
assertTrue(StudentEmail.isValidEmail("[email protected]")); // more than one period in domain |
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.
I like how you design the test cases!
No description provided.