8b30567e5ec2bba1b22a6ad0ecfcdd77da231030
[staff/due1/sed-hs15-srs-purple.git] / src / test / java / ch / bfh / ti / srs / core / UserTest.java
1 /*
2 * Copyright (c) 2015 Berner Fachhochschule, Switzerland.
3 *
4 * Project Smart Reservation System.
5 *
6 * Distributable under GPL license. See terms of license at gnu.org.
7 */
8 package ch.bfh.ti.srs.core;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
13
14 import org.junit.Ignore;
15 import org.junit.Test;
16
17 public class UserTest {
18
19 @Test
20 public void createUserTest() {
21 User testUser = new User("TestUser", "pass");
22 assertEquals("TestUser", testUser.getUserName());
23 }
24
25 @Ignore
26 public void checkPasswordTest() {
27 User testUser = new User("TestUser", "pass");
28 assertTrue(testUser.checkPassword("pass"));
29 assertFalse(testUser.checkPassword("notmypass"));
30 }
31
32 @Ignore
33 public void changePasswordTest() {
34 User testUser = new User("TestUser", "pass");
35 assertTrue(testUser.checkPassword("pass"));
36 testUser.changePassword("newpass");
37 assertTrue(testUser.checkPassword("newpass"));
38 assertFalse(testUser.checkPassword("pass"));
39 assertFalse(testUser.checkPassword("notmypass"));
40 }
41
42 @Ignore
43 public void setMailTest() {
44 User testUser = new User("TestUser", "pass");
45 String goodMail = "grosm9@bfh.ch";
46 String wrongMail1 = "ioajfd.ch";
47 String wrongMail2 = "asjdfh@fds";
48
49 assertTrue(testUser.setMail(goodMail));
50 assertFalse(testUser.setMail(wrongMail1));
51 assertFalse(testUser.setMail(wrongMail2));
52 }
53
54 @Ignore
55 public void getMailTest() {
56 User testUser = new User("TestUser", "pass");
57 String mail = "grosm9@bfh.ch";
58
59 testUser.setMail(mail);
60 assertEquals(mail, testUser.getMail());
61 }
62
63 @Ignore
64 public void setAndGetNameTest() {
65 User testUser = new User("TestUser", "pass");
66 testUser.setName("Tester");
67 assertEquals("Tester",testUser.getName());
68 }
69
70 @Ignore
71 public void setAndGetLastnameTest() {
72 User testUser = new User("TestUser", "pass");
73 testUser.setLastname("Dummy");
74 assertEquals("Dummy", testUser.getLastname());
75 }
76 }