@@ -15,47 +15,61 @@ class AccountDataValidatorTest {
1515 fun `validateUsername should return valid if receives a valid username` () {
1616 val myUsername = " tester"
1717 AccountDataValidator .validateUsername(myUsername) `should equal` FormData .Valid (" tester" )
18+ AccountDataValidator .validateUsernameOnly(myUsername) `should equal` FormData .Valid (" tester" )
1819 }
1920
2021 @Test
2122 fun `validateUsername should return valid if receives less than 3 characters` () {
2223 val myUsername = " t"
2324 AccountDataValidator .validateUsername(myUsername) `should be instance of` FormData .Error ::class .java
25+ AccountDataValidator .validateUsernameOnly(myUsername) `should be instance of` FormData .Error ::class .java
2426 }
2527
2628 @Test
2729 fun `validateUsername should return error if receives spaces in the middle of the username` () {
2830 val myUsername = " anew tester"
2931 AccountDataValidator .validateUsername(myUsername) `should be instance of` FormData .Error ::class .java
32+ AccountDataValidator .validateUsernameOnly(myUsername) `should be instance of` FormData .Error ::class .java
3033 }
3134
3235 @Test
3336 fun `validateUsername should return error if receives invalid characters in username` () {
3437 val myUsername = " test#"
3538 AccountDataValidator .validateUsername(myUsername) `should be instance of` FormData .Error ::class .java
39+ AccountDataValidator .validateUsernameOnly(myUsername) `should be instance of` FormData .Error ::class .java
3640 }
3741
3842 @Test
3943 fun `validateUsername should return error if username starts with dot` () {
4044 val myUsername = " .tester"
4145 AccountDataValidator .validateUsername(myUsername) `should be instance of` FormData .Error ::class .java
46+ AccountDataValidator .validateUsernameOnly(myUsername) `should be instance of` FormData .Error ::class .java
4247 }
4348
4449 @Test
4550 fun `validateUsername should return valid if receives dots, dashes or lowdashes in username` () {
4651 val myUsername = " test.t_est-er05"
4752 AccountDataValidator .validateUsername(myUsername) `should be instance of` FormData .Valid ::class .java
53+ AccountDataValidator .validateUsernameOnly(myUsername) `should be instance of` FormData .Valid ::class .java
4854 }
4955
5056 @Test
5157 fun `validateEmailAddress should return valid if receives a valid address` () {
5258 val address = " somebody@gmail.com"
5359 AccountDataValidator .validateEmailAddress(address) `should equal` FormData .Valid (address)
60+ AccountDataValidator .validateUsername(address) `should equal` FormData .Valid (address)
61+ }
62+
63+ @Test
64+ fun `validateUsernameOnly should return error if receives an email address` () {
65+ val address = " somebody@gmail.com"
66+ AccountDataValidator .validateUsernameOnly(address) `should be instance of` FormData .Error ::class .java
5467 }
5568
5669 @Test
5770 fun `validateEmailAddress should return error if receives angular brackets and spaces` () {
5871 val address = " Some User <somebody@gmail.com>"
5972 AccountDataValidator .validateEmailAddress(address) `should be instance of` FormData .Error ::class .java
73+ AccountDataValidator .validateUsername(address) `should be instance of` FormData .Error ::class .java
6074 }
6175}
0 commit comments