setPasswordTest()
authorMichael <Michael@Michael-LT.bfh.ch>
Wed, 21 Oct 2015 09:12:22 +0000 (11:12 +0200)
committerMichael <Michael@Michael-LT.bfh.ch>
Wed, 21 Oct 2015 09:12:22 +0000 (11:12 +0200)
checkPasswordTest()
setMailTest()
getMailTest()

src/test/java/ch/bfh/ti/srs/core/UserTest.java

index caf2ed8..23942cc 100644 (file)
@@ -15,7 +15,7 @@ import org.junit.BeforeClass;
 import org.junit.Test;\r
 \r
 public class UserTest {\r
-       private Set<User> userList = new Set<>();\r
+       private Set<User> userList;\r
        User TestUser;\r
        \r
        @BeforeClass\r
@@ -24,15 +24,42 @@ public class UserTest {
        }\r
 \r
        @Test\r
-       public void CreateUserTest() {\r
-               TestUser = new User(TestUser,"1234");\r
+       public void createUserTest() {\r
+               TestUser = new User("TestUser","pass");\r
                assertEquals("TestUser", TestUser.getUserName());\r
        }\r
        \r
        @Test\r
-       public void CheckPasswordTest() {\r
-               assertTrue(TestUser.checkPassword("1234"));\r
-               assertFalse(TestUser.checkPassword("4321"));\r
+       public void checkPasswordTest() {\r
+               assertTrue(TestUser.checkPassword("pass"));\r
+               assertFalse(TestUser.checkPassword("notmypass"));\r
+       }\r
+       \r
+       @Test\r
+       public void changePasswordTest() {\r
+               assertTrue(TestUser.checkPassword("pass"));\r
+               TestUser.changePassword("newpass");\r
+               assertTrue(TestUser.checkPassword("newpass"));\r
+               assertFalse(TestUser.checkPassword("pass"));\r
+               assertFalse(TestUser.checkPassword("notmypass"));\r
+       }\r
+       \r
+       @Test\r
+       public void setMailTest() {\r
+               String goodMail = "grosm9@bfh.ch";\r
+               String wrongMail1 = "ioajfd.ch";\r
+               String wrongMail2 = "asjdfh@fds";\r
+               \r
+               assertTrue(TestUser.setMail(goodMail));\r
+               assertFalse(TestUser.setMail(wrongMail1));\r
+               assertFalse(TestUser.setMail(wrongMail2));\r
+       }\r
+       \r
+       public void getMailTest() {\r
+               String mail = "grosm9@bfh.ch";\r
+               \r
+               TestUser.setMail(mail);\r
+               assertEquals(mail, TestUser.getMail());\r
        }\r
 \r
 }\r