DataHandlerForTestsTest added,
[staff/due1/sed-hs15-srs-purple.git] / src / test / java / ch / bfh / ti / srs / core / UserTest.java
index 6c5f414..02b8cbb 100644 (file)
@@ -15,6 +15,8 @@ import org.junit.Rule;
 import org.junit.Test;\r
 import org.junit.rules.ExpectedException;\r
 \r
+import ch.bfh.ti.srs.extern.Password;\r
+\r
 /**\r
  * @author Michael Grossen\r
  */\r
@@ -37,6 +39,23 @@ public class UserTest {
                User wrongArgumentUser2 = new User("TestUser2", null);*/\r
        }\r
        \r
+       @Test\r
+       public void createExistingTest() throws Exception{\r
+               User testUser = new User("TestUser", "pass", "grosm9@bfh.ch", "Test", "Dummy");\r
+               assertEquals("TestUser", testUser.getUserName());\r
+               assertEquals("pass", testUser.getEncryptedPassword());\r
+               assertEquals("grosm9@bfh.ch", testUser.getMail());\r
+               assertEquals("Test", testUser.getName());\r
+               assertEquals("Dummy", testUser.getLastname());\r
+       }\r
+       \r
+       @Test\r
+       public void getEncryptedPasswordTest() throws Exception{\r
+               String encryptedPass = Password.getSaltedHash("testPassword");\r
+               User testUser = new User("TestUser", encryptedPass, "grosm9@bfh.ch", "Test", "Dummy");\r
+               assertEquals(encryptedPass, testUser.getEncryptedPassword());\r
+       }\r
+       \r
        @Test(expected=IllegalArgumentException.class)\r
        public void createUserInvalidUsernameTest() throws Exception{\r
                User testUser = new User(null,"pass");\r