SessionController added/updated
authorMichael <Michael@192.168.3.155>
Fri, 8 Jan 2016 12:51:17 +0000 (13:51 +0100)
committerMichael <Michael@192.168.3.155>
Fri, 8 Jan 2016 12:51:17 +0000 (13:51 +0100)
ResourceController minorfix
UserController updated
Controller/SessionController minorfix

src/main/java/ch/bfh/ti/srs/controller/Controller.java
src/main/java/ch/bfh/ti/srs/controller/SessionController.java
src/test/java/ch/bfh/ti/srs/controller/ResourceManagerControllerTest.java
src/test/java/ch/bfh/ti/srs/controller/SessionControllerTest.java [new file with mode: 0644]
src/test/java/ch/bfh/ti/srs/controller/UserControllerTest.java

index 786d6c7..d7d88ae 100644 (file)
@@ -42,6 +42,7 @@ public abstract class Controller {
         */\r
        public Controller(DataHandler dh, SessionController sc) {\r
                this.dh = dh;\r
+               this.sc = sc;\r
        }\r
 \r
        /**\r
index 04484d0..9e5e4b9 100644 (file)
@@ -20,8 +20,13 @@ public class SessionController {
        private DataHandler dh;\r
        private User currentUser;       \r
 \r
+       public SessionController(DataHandler dh){\r
+               this.dh = dh;\r
+               controllers = new HashSet<Controller>();\r
+       }\r
+       \r
        public SessionController(){\r
-               dh = new DataHandlerForTests();\r
+               this.dh = new DataHandlerForTests();\r
                controllers = new HashSet<Controller>();\r
        }\r
        \r
@@ -45,19 +50,22 @@ public class SessionController {
                User tempUser = dh.findUser(userName);\r
                if (tempUser != null || tempUser.checkPassword(password)){\r
                        currentUser = tempUser;\r
+                       controllers.clear();\r
                        \r
-                       Set<Controller> retSet = new HashSet<Controller>();\r
                        for (Role role : currentUser.getRoles()) {\r
                                switch(role){\r
                                        case User:\r
-                                               retSet.add(new UserController(dh, this));\r
+                                               controllers.add(new UserController(dh, this));\r
                                        case ResourceManager:\r
-                                               retSet.add(new ResourceManagerController(dh, this));\r
+                                               controllers.add(new ResourceManagerController(dh, this));\r
                                        case Admin:\r
-                                               \r
+                                               //Add AdminController to controllers\r
                                }\r
                        }\r
                }\r
+               else{\r
+                       throw new Exception("Username or password wrong");\r
+               }\r
                return controllers;\r
        }\r
 \r
index 4fcb251..1a71767 100644 (file)
@@ -19,7 +19,7 @@ public class ResourceManagerControllerTest {
        @Test\r
        public void AddResourceTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController();\r
+               SessionController  sc = new SessionController(dh);\r
                ResourceManagerController rmc = new ResourceManagerController(dh, sc);\r
                Resource testResource = new Resource("N321", "class room");\r
                \r
@@ -29,7 +29,7 @@ public class ResourceManagerControllerTest {
        @Test\r
        public void ChangeResourceTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController();\r
+               SessionController  sc = new SessionController(dh);\r
                ResourceManagerController rmc = new ResourceManagerController(dh, sc);\r
                Resource testResource = new Resource("N321", "class room");\r
                \r
@@ -41,7 +41,7 @@ public class ResourceManagerControllerTest {
        @Test\r
        public void DeleteResourceTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController();\r
+               SessionController  sc = new SessionController(dh);\r
                ResourceManagerController rmc = new ResourceManagerController(dh, sc);\r
                Resource testResource = new Resource("N321", "class room");\r
                \r
@@ -51,7 +51,8 @@ public class ResourceManagerControllerTest {
        \r
        @Test(expected = Exception.class)\r
        public void AddResourceInvalidDatahandlerTest() throws Exception {\r
-               SessionController  sc = new SessionController();\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController  sc = new SessionController(dh);\r
                ResourceManagerController rmc = new ResourceManagerController(null, sc);\r
                Resource testResource = new Resource("N321", "class room");\r
                \r
@@ -62,7 +63,7 @@ public class ResourceManagerControllerTest {
        @Test(expected = IllegalArgumentException.class)\r
        public void AddResourceInvalidResourceTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController();\r
+               SessionController  sc = new SessionController(dh);\r
                ResourceManagerController rmc = new ResourceManagerController(dh, sc);\r
                Resource testResource = null;\r
                \r
@@ -72,7 +73,7 @@ public class ResourceManagerControllerTest {
        @Test(expected = Exception.class)\r
        public void ChangeResourceInvalidDatahandlerTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController();\r
+               SessionController  sc = new SessionController(dh);\r
                ResourceManagerController rmc1 = new ResourceManagerController(dh, sc);\r
                ResourceManagerController rmc2 = new ResourceManagerController(null, sc);\r
                Resource testResource = new Resource("N321", "class room");\r
@@ -85,7 +86,7 @@ public class ResourceManagerControllerTest {
        @Test(expected = IllegalArgumentException.class)\r
        public void ChangeResourceInvalidResourceTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController();\r
+               SessionController  sc = new SessionController(dh);\r
                ResourceManagerController rmc = new ResourceManagerController(dh, sc);\r
                Resource testResource = new Resource("N321", "class room");\r
                \r
@@ -97,7 +98,7 @@ public class ResourceManagerControllerTest {
        @Test(expected = Exception.class)\r
        public void DeleteResourceInvalidDatahandlerTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController();\r
+               SessionController  sc = new SessionController(dh);\r
                ResourceManagerController rmc1 = new ResourceManagerController(dh, sc);\r
                ResourceManagerController rmc2 = new ResourceManagerController(null, sc);\r
                Resource testResource = new Resource("N321", "class room");\r
@@ -110,7 +111,7 @@ public class ResourceManagerControllerTest {
        @Test(expected = IllegalArgumentException.class)\r
        public void DeleteResourceInvalidResourceTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController();\r
+               SessionController  sc = new SessionController(dh);\r
                ResourceManagerController rmc = new ResourceManagerController(dh, sc);\r
                Resource testResource = new Resource("N321", "class room");\r
                \r
diff --git a/src/test/java/ch/bfh/ti/srs/controller/SessionControllerTest.java b/src/test/java/ch/bfh/ti/srs/controller/SessionControllerTest.java
new file mode 100644 (file)
index 0000000..dcca926
--- /dev/null
@@ -0,0 +1,221 @@
+/*\r
+ * Copyright (c) 2015 Berner Fachhochschule, Switzerland.\r
+ *\r
+ * Project Smart Reservation System.\r
+ *\r
+ * Distributable under GPL license. See terms of license at gnu.org.\r
+ */\r
+package ch.bfh.ti.srs.controller;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertFalse;\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.util.Set;\r
+\r
+import org.junit.Test;\r
+\r
+import ch.bfh.ti.srs.datahandler.DataHandler;\r
+import ch.bfh.ti.srs.datahandler.DataHandlerForTests;\r
+import ch.bfh.ti.srs.dataschema.Role;\r
+import ch.bfh.ti.srs.dataschema.User;\r
+\r
+public class SessionControllerTest {\r
+\r
+       \r
+       @Test\r
+       public void logInTest() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(dh);\r
+               UserController uc = new UserController(dh,sc);\r
+\r
+               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
+               uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
+               uc.addUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
+               uc.addUser("TestUser4", "pass4", "grosm9@bfh.ch", "Test", "User");\r
+\r
+               User user3 = uc.getUser("TestUser3");\r
+               user3.addRole(Role.User);\r
+               user3.addRole(Role.ResourceManager);\r
+               \r
+               Set<Controller> controllers = sc.logIn("TestUser3", "pass3");\r
+               assertFalse(controllers.isEmpty());\r
+       }\r
+\r
+       @Test(expected = Exception.class)\r
+       public void logInException1Test() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(dh);\r
+               UserController uc = new UserController(dh,sc);\r
+\r
+               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
+               uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
+\r
+               sc.logIn("TestUser1", "pass1");\r
+               sc.logIn("TestUser2", "pass2");\r
+       }\r
+\r
+       @Test(expected = Exception.class)\r
+       public void logInInvalidCredetialsTest() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(dh);\r
+               UserController uc = new UserController(dh,sc);\r
+\r
+               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
+               uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
+\r
+               sc.logIn("TestUser3", "pass3");\r
+       }\r
+\r
+       @SuppressWarnings("deprecation")\r
+       @Test\r
+       public void getLoggedUserNameTest() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(dh);\r
+               UserController uc = new UserController(dh,sc);\r
+\r
+               //uc.setDataHandler(dh);\r
+               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
+               uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
+               uc.addUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
+               uc.addUser("TestUser4", "pass4", "grosm9@bfh.ch", "Test", "User");\r
+\r
+               sc.logIn("TestUser1", "pass1");\r
+               assertEquals("TestUser1", sc.getLoggedUserName());\r
+       }\r
+\r
+       @SuppressWarnings("deprecation")\r
+       @Test(expected = Exception.class)\r
+       public void getLoggedUserNameExceptionTest() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(dh);\r
+\r
+               sc.getLoggedUserName();\r
+       }\r
+\r
+       @SuppressWarnings("deprecation")\r
+       @Test\r
+       public void getLoggedUserMailTest() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(dh);\r
+               UserController uc = new UserController(dh,sc);\r
+\r
+               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
+               uc.addUser("TestUser2", "pass2", "hanfli@bfh.ch", null, null);\r
+               uc.addUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
+               uc.addUser("TestUser4", "pass4", "grosm9@bfh.ch", "Test", "User");\r
+\r
+               sc.logIn("TestUser2", "pass2");\r
+               assertEquals("hanfli@bfh.ch", sc.getLoggedMail());\r
+       }\r
+\r
+       @SuppressWarnings("deprecation")\r
+       @Test(expected = Exception.class)\r
+       public void getLoggedMailExceptionTest() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(dh);\r
+\r
+               sc.getLoggedMail();\r
+       }\r
+\r
+       @SuppressWarnings("deprecation")\r
+       @Test\r
+       public void getLoggedNameTest() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(dh);\r
+               UserController uc = new UserController(dh,sc);\r
+\r
+               //uc.setDataHandler(dh);\r
+               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
+               uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
+               uc.addUser("TestUser3", "pass3", "grosm9@bfh.ch", "Hanfli", null);\r
+               uc.addUser("TestUser4", "pass4", "grosm9@bfh.ch", "Test", "User");\r
+\r
+               sc.logIn("TestUser3", "pass3");\r
+               assertEquals("Hanfli", sc.getLoggedName());\r
+       }\r
+\r
+       @SuppressWarnings("deprecation")\r
+       @Test(expected = Exception.class)\r
+       public void getLoggedNameExceptionTest() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(dh);\r
+\r
+               sc.getLoggedName();\r
+       }\r
+\r
+       @SuppressWarnings("deprecation")\r
+       @Test\r
+       public void getLoggedLastnameTest() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(dh);\r
+               UserController uc = new UserController(dh,sc);\r
+\r
+               //uc.setDataHandler(dh);\r
+               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
+               uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
+               uc.addUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
+               uc.addUser("TestUser4", "pass4", "grosm9@bfh.ch", "Test", "User");\r
+\r
+               sc.logIn("TestUser4", "pass4");\r
+               assertEquals("User", sc.getLoggedLastname());\r
+       }\r
+\r
+       @SuppressWarnings("deprecation")\r
+       @Test(expected = Exception.class)\r
+       public void getLoggedLastnameExceptionTest() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(dh);\r
+\r
+               sc.getLoggedLastname();\r
+       }\r
+\r
+       @Test\r
+       public void getLoggedUserTest() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(dh);\r
+               UserController uc = new UserController(dh,sc);\r
+\r
+               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
+               assertEquals(null, sc.getLoggedUser());\r
+               sc.logIn("TestUser1", "pass1");\r
+               assertEquals("TestUser1", sc.getLoggedUser().getUserName());\r
+       }\r
+\r
+       @SuppressWarnings("deprecation")\r
+       @Test\r
+       public void logOutTest() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(dh);\r
+               UserController uc = new UserController(dh,sc);\r
+\r
+               //uc.setDataHandler(dh);\r
+               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
+               uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
+               uc.addUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
+               uc.addUser("TestUser4", "pass4", "grosm9@bfh.ch", "Test", "User");\r
+\r
+               sc.logIn("TestUser1", "pass1");\r
+               assertEquals("TestUser1", sc.getLoggedUserName());\r
+               sc.logOut();\r
+       }\r
+\r
+       @Test(expected = Exception.class)\r
+       public void logOutException1Test() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(dh);\r
+\r
+               sc.logOut();\r
+       }\r
+\r
+       @Test(expected = Exception.class)\r
+       public void logOutException2Test() throws Exception {\r
+               DataHandler dh = new DataHandlerForTests();\r
+               SessionController sc = new SessionController(null);\r
+\r
+               sc.logOut();\r
+       }\r
+\r
+\r
+\r
+}\r
index 26b9436..46831ed 100644 (file)
@@ -31,8 +31,6 @@ import ch.bfh.ti.srs.dataschema.User;
  * @author Michael Grossen\r
  */\r
 public class UserControllerTest {\r
-\r
-       /*\r
        @Test\r
        public void addUserTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
@@ -55,179 +53,7 @@ public class UserControllerTest {
 \r
                uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
        }\r
-\r
-       @Test\r
-       public void logInTest() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               SessionController sc = new SessionController();\r
-               UserController uc = new UserController(dh,sc);\r
-\r
-               //uc.setDataHandler(dh);\r
-               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
-               uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
-               uc.addUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
-               uc.addUser("TestUser4", "pass4", "grosm9@bfh.ch", "Test", "User");\r
-\r
-               uc.logIn("TestUser3", "pass3");\r
-       }\r
-\r
-       @Test(expected = Exception.class)\r
-       public void logInException1Test() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-               uc.setDataHandler(null);\r
-               uc.logIn("TestUser3", "pass3");\r
-       }\r
-\r
-       @Test(expected = Exception.class)\r
-       public void logInException2Test() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-\r
-               //uc.setDataHandler(dh);\r
-               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
-               uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
-\r
-               uc.logIn("TestUser1", "pass1");\r
-               uc.logIn("TestUser2", "pass2");\r
-       }\r
-\r
-       @Test\r
-       public void logInInvalidCredetialsTest() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-\r
-               //uc.setDataHandler(dh);\r
-               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
-               uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
-\r
-               assertFalse(uc.logIn("TestUser3", "pass3"));\r
-               assertFalse(uc.logIn("TestUser1", "pass2"));\r
-               assertTrue(uc.logIn("TestUser1", "pass1"));\r
-       }\r
-\r
-       @SuppressWarnings("deprecation")\r
-       @Test\r
-       public void getLoggedUserNameTest() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-\r
-               //uc.setDataHandler(dh);\r
-               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
-               uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
-               uc.addUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
-               uc.addUser("TestUser4", "pass4", "grosm9@bfh.ch", "Test", "User");\r
-\r
-               uc.logIn("TestUser1", "pass1");\r
-               assertEquals("TestUser1", uc.getLoggedUserName());\r
-       }\r
-\r
-       @SuppressWarnings("deprecation")\r
-       @Test(expected = Exception.class)\r
-       public void getLoggedUserNameExceptionTest() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-               uc.setDataHandler(null);\r
-               uc.getLoggedUserName();\r
-       }\r
-\r
-       @SuppressWarnings("deprecation")\r
-       @Test\r
-       public void getLoggedUserMailTest() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-\r
-               //uc.setDataHandler(dh);\r
-               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
-               uc.addUser("TestUser2", "pass2", "hanfli@bfh.ch", null, null);\r
-               uc.addUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
-               uc.addUser("TestUser4", "pass4", "grosm9@bfh.ch", "Test", "User");\r
-\r
-               uc.logIn("TestUser2", "pass2");\r
-               assertEquals("hanfli@bfh.ch", uc.getLoggedMail());\r
-       }\r
-\r
-       @SuppressWarnings("deprecation")\r
-       @Test(expected = Exception.class)\r
-       public void getLoggedMailExceptionTest() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-               uc.setDataHandler(null);\r
-               uc.getLoggedMail();\r
-       }\r
-\r
-       @SuppressWarnings("deprecation")\r
-       @Test\r
-       public void getLoggedNameTest() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-\r
-               //uc.setDataHandler(dh);\r
-               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
-               uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
-               uc.addUser("TestUser3", "pass3", "grosm9@bfh.ch", "Hanfli", null);\r
-               uc.addUser("TestUser4", "pass4", "grosm9@bfh.ch", "Test", "User");\r
-\r
-               uc.logIn("TestUser3", "pass3");\r
-               assertEquals("Hanfli", uc.getLoggedName());\r
-       }\r
-\r
-       @SuppressWarnings("deprecation")\r
-       @Test(expected = Exception.class)\r
-       public void getLoggedNameExceptionTest() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-               uc.setDataHandler(null);\r
-               uc.getLoggedName();\r
-       }\r
-\r
-       @SuppressWarnings("deprecation")\r
-       @Test\r
-       public void getLoggedLastnameTest() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-\r
-               //uc.setDataHandler(dh);\r
-               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
-               uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
-               uc.addUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
-               uc.addUser("TestUser4", "pass4", "grosm9@bfh.ch", "Test", "User");\r
-\r
-               uc.logIn("TestUser4", "pass4");\r
-               assertEquals("User", uc.getLoggedLastname());\r
-       }\r
-\r
-       @SuppressWarnings("deprecation")\r
-       @Test(expected = Exception.class)\r
-       public void getLoggedLastnameExceptionTest() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-               uc.setDataHandler(null);\r
-               uc.getLoggedLastname();\r
-       }\r
-\r
-       @Test\r
-       public void getLoggedUserTest() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-\r
-               //uc.setDataHandler(dh);\r
-               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
-               assertEquals(null, uc.getLoggedUser());\r
-               uc.logIn("TestUser1", "pass1");\r
-               assertEquals("TestUser1", uc.getLoggedUser().getUserName());\r
-       }\r
-\r
-       // @Test(expected=Exception.class)\r
-       // public void getLoggedUserExceptionTest() throws Exception{\r
-       // DataHandler dh = new DataHandlerForTests();\r
-       // UserController uc = new UserController(dh);\r
-       //\r
-       // uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
-       // uc.logIn("TestUser1", "pass1");\r
-       // assertEquals("TestUser1", uc.getLoggedUser().getUserName());\r
-       // }\r
-\r
+       \r
        @Test\r
        public void getUserTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
@@ -249,42 +75,7 @@ public class UserControllerTest {
                uc.logIn("TestUser1", "pass1");\r
                assertEquals("grosm9@bfh.ch", uc.getUser("TestUser1").getMail());\r
        }\r
-\r
-       @SuppressWarnings("deprecation")\r
-       @Test\r
-       public void logOutTest() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-\r
-               //uc.setDataHandler(dh);\r
-               uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
-               uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
-               uc.addUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
-               uc.addUser("TestUser4", "pass4", "grosm9@bfh.ch", "Test", "User");\r
-\r
-               uc.logIn("TestUser1", "pass1");\r
-               assertEquals("TestUser1", uc.getLoggedUserName());\r
-               uc.logOut();\r
-       }\r
-\r
-       @Test(expected = Exception.class)\r
-       public void logOutException1Test() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-               uc.setDataHandler(null);\r
-\r
-               uc.logOut();\r
-       }\r
-\r
-       @Test(expected = Exception.class)\r
-       public void logOutException2Test() throws Exception {\r
-               DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController(dh);\r
-\r
-               //uc.setDataHandler(dh);\r
-               uc.logOut();\r
-       }\r
-\r
+       \r
        @Test(expected = Exception.class)\r
        public void getUserExpectionTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
@@ -292,7 +83,7 @@ public class UserControllerTest {
                uc.setDataHandler(null);\r
                uc.getUser(null);\r
        }\r
-\r
+       \r
        @SuppressWarnings("deprecation")\r
        @Test\r
        public void getReservationTests() throws Exception {\r
@@ -947,5 +738,4 @@ public class UserControllerTest {
 \r
                assertEquals(3, resList.size());\r
        }\r
-       */\r
 }\r