Split UserController into 'Controller' and 'UserController extends
[staff/due1/sed-hs15-srs-purple.git] / src / test / java / ch / bfh / ti / srs / controller / UserControllerTest.java
index 5b06f2a..0a29a09 100644 (file)
@@ -40,9 +40,9 @@ public class UserControllerTest {
        @Test\r
        public void addUserTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(dh);\r
 \r
-               uc.setDataHandler(dh);\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
@@ -52,7 +52,8 @@ public class UserControllerTest {
        @Test(expected = Exception.class)\r
        public void addUserExceptionTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(dh);\r
+               uc.setDataHandler(null);\r
 \r
                uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
        }\r
@@ -60,9 +61,9 @@ public class UserControllerTest {
        @Test\r
        public void logInTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(dh);\r
 \r
-               uc.setDataHandler(dh);\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
@@ -74,16 +75,17 @@ public class UserControllerTest {
        @Test(expected = Exception.class)\r
        public void logInException1Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\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();\r
+               UserController uc = new UserController(dh);\r
 \r
-               uc.setDataHandler(dh);\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
@@ -94,9 +96,9 @@ public class UserControllerTest {
        @Test\r
        public void logInInvalidCredetialsTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(dh);\r
 \r
-               uc.setDataHandler(dh);\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
@@ -108,9 +110,9 @@ public class UserControllerTest {
        @Test\r
        public void getLoggedUserNameTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(dh);\r
 \r
-               uc.setDataHandler(dh);\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
@@ -122,16 +124,18 @@ public class UserControllerTest {
 \r
        @Test(expected = Exception.class)\r
        public void getLoggedUserNameExceptionTest() throws Exception {\r
-               UserController uc = new UserController();\r
+               DataHandler dh = new DataHandlerForTests();\r
+               UserController uc = new UserController(dh);\r
+               uc.setDataHandler(null);\r
                String currentUserName = uc.getLoggedUserName();\r
        }\r
 \r
        @Test\r
        public void getLoggedUserMailTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(dh);\r
 \r
-               uc.setDataHandler(dh);\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
@@ -143,16 +147,18 @@ public class UserControllerTest {
 \r
        @Test(expected = Exception.class)\r
        public void getLoggedMailExceptionTest() throws Exception {\r
-               UserController uc = new UserController();\r
+               DataHandler dh = new DataHandlerForTests();\r
+               UserController uc = new UserController(dh);\r
+               uc.setDataHandler(null);\r
                String currentMail = uc.getLoggedMail();\r
        }\r
 \r
        @Test\r
        public void getLoggedNameTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(dh);\r
 \r
-               uc.setDataHandler(dh);\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
@@ -164,16 +170,18 @@ public class UserControllerTest {
 \r
        @Test(expected = Exception.class)\r
        public void getLoggedNameExceptionTest() throws Exception {\r
-               UserController uc = new UserController();\r
+               DataHandler dh = new DataHandlerForTests();\r
+               UserController uc = new UserController(dh);\r
+               uc.setDataHandler(null);\r
                uc.getLoggedName();\r
        }\r
 \r
        @Test\r
        public void getLoggedLastnameTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(dh);\r
 \r
-               uc.setDataHandler(dh);\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
@@ -185,16 +193,18 @@ public class UserControllerTest {
 \r
        @Test(expected = Exception.class)\r
        public void getLoggedLastnameExceptionTest() throws Exception {\r
-               UserController uc = new UserController();\r
+               DataHandler dh = new DataHandlerForTests();\r
+               UserController uc = new UserController(dh);\r
+               uc.setDataHandler(null);\r
                String currentLastName = uc.getLoggedLastname();\r
        }\r
 \r
        @Test\r
        public void getLoggedUserTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(dh);\r
 \r
-               uc.setDataHandler(dh);\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
@@ -204,7 +214,7 @@ public class UserControllerTest {
        // @Test(expected=Exception.class)\r
        // public void getLoggedUserExceptionTest() throws Exception{\r
        // DataHandler dh = new DataHandlerForTests();\r
-       // UserController uc = new UserController();\r
+       // UserController uc = new UserController(dh);\r
        //\r
        // uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
        // uc.logIn("TestUser1", "pass1");\r
@@ -214,9 +224,9 @@ public class UserControllerTest {
        @Test\r
        public void getUserTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(dh);\r
 \r
-               uc.setDataHandler(dh);\r
+               //uc.setDataHandler(dh);\r
                uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                uc.logIn("TestUser1", "pass1");\r
                assertEquals("grosm9@bfh.ch", uc.getUser("TestUser1").getMail());\r
@@ -225,7 +235,8 @@ public class UserControllerTest {
        @Test(expected = Exception.class)\r
        public void getUserExceptionTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(dh);\r
+               uc.setDataHandler(null);\r
 \r
                uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                uc.logIn("TestUser1", "pass1");\r
@@ -235,9 +246,9 @@ public class UserControllerTest {
        @Test\r
        public void logOutTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(dh);\r
 \r
-               uc.setDataHandler(dh);\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
@@ -251,7 +262,8 @@ public class UserControllerTest {
        @Test(expected = Exception.class)\r
        public void logOutException1Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(dh);\r
+               uc.setDataHandler(null);\r
 \r
                uc.logOut();\r
        }\r
@@ -259,23 +271,25 @@ public class UserControllerTest {
        @Test(expected = Exception.class)\r
        public void logOutException2Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(dh);\r
 \r
-               uc.setDataHandler(dh);\r
+               //uc.setDataHandler(dh);\r
                uc.logOut();\r
        }\r
 \r
        @Test(expected = Exception.class)\r
        public void getUserExpectionTest() throws Exception {\r
-               UserController uc = new UserController();\r
+               DataHandler dh = new DataHandlerForTests();\r
+               UserController uc = new UserController(dh);\r
+               uc.setDataHandler(null);\r
                uc.getUser(null);\r
        }\r
 \r
        @Test\r
        public void getReservationTests() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -330,65 +344,70 @@ public class UserControllerTest {
 \r
        @Test(expected = Exception.class)\r
        public void getReservationGroupException1Test() throws Exception {\r
-               UserController uc = new UserController();\r
+               DataHandler dh = new DataHandlerForTests();\r
+               UserController uc = new UserController(dh);\r
+               uc.setDataHandler(null);\r
                uc.getReservationGroup(null);\r
        }\r
 \r
        @Test(expected = IllegalArgumentException.class)\r
        public void getReservationGroupException2Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\r
+               //uc.setDataHandler(dh);\r
                uc.getReservationGroup(null);\r
        }\r
 \r
        @Test(expected = Exception.class)\r
        public void getUserReservationException1Test() throws Exception {\r
-               UserController uc = new UserController();\r
+               DataHandler dh = new DataHandlerForTests();\r
+               UserController uc = new UserController(dh);\r
+               uc.setDataHandler(null);\r
                uc.getUserReservations(null);\r
        }\r
 \r
        @Test(expected = Exception.class)\r
        public void getUserReservationException2Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\r
+               //uc.setDataHandler(dh);\r
                uc.getUserReservations(null);\r
        }\r
 \r
        @Test(expected = Exception.class)\r
        public void getReservationException1Test() throws Exception {\r
-               UserController uc = new UserController();\r
+               DataHandler dh = new DataHandlerForTests();\r
+               UserController uc = new UserController(dh);\r
                uc.getReservation(null);\r
        }\r
 \r
        @Test(expected = Exception.class)\r
        public void getReservationException2Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\r
+               //uc.setDataHandler(dh);\r
                uc.getReservation(null);\r
        }\r
 \r
        @Test(expected = Exception.class)\r
        public void getReservationsInDateRangeException1Test() throws Exception {\r
-               UserController uc = new UserController();\r
+               UserController uc = new UserController(null);\r
                uc.getReservationsInDateRange(null);\r
        }\r
 \r
        @Test(expected = Exception.class)\r
        public void getReservationsInDateRangeException2Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\r
+               //uc.setDataHandler(dh);\r
                uc.getReservationsInDateRange(null);\r
        }\r
 \r
        @Test\r
        public void makeReservationTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -412,8 +431,8 @@ public class UserControllerTest {
        @Test\r
        public void makeInvalidReservationTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -448,8 +467,8 @@ public class UserControllerTest {
        @Test(expected = IllegalArgumentException.class)\r
        public void makeReservationException1Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -473,8 +492,8 @@ public class UserControllerTest {
        @Test(expected = IllegalArgumentException.class)\r
        public void makeReservationException2Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -497,8 +516,8 @@ public class UserControllerTest {
        @Test(expected = IllegalArgumentException.class)\r
        public void makeReservationException3Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -521,8 +540,8 @@ public class UserControllerTest {
        @Test(expected = IllegalArgumentException.class)\r
        public void makeReservationException4Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -542,8 +561,8 @@ public class UserControllerTest {
        @Test\r
        public void changeReservationTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -573,8 +592,8 @@ public class UserControllerTest {
        @Test(expected = Exception.class)\r
        public void changeReservationException1Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -611,8 +630,8 @@ public class UserControllerTest {
        @Test(expected = Exception.class)\r
        public void changeReservationException2Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -649,8 +668,8 @@ public class UserControllerTest {
        @Test(expected = IllegalArgumentException.class)\r
        public void changeReservationException3Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -686,8 +705,8 @@ public class UserControllerTest {
        @Test(expected = Exception.class)\r
        public void changeReservationException4Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -725,8 +744,8 @@ public class UserControllerTest {
        @Test\r
        public void deleteReservationTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -756,8 +775,8 @@ public class UserControllerTest {
        @Test(expected = Exception.class)\r
        public void deleteReservationException1Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -788,8 +807,8 @@ public class UserControllerTest {
        @Test(expected = Exception.class)\r
        public void deleteReservationException2Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -820,8 +839,8 @@ public class UserControllerTest {
        @Test(expected = IllegalArgumentException.class)\r
        public void deleteReservationException3Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -851,8 +870,8 @@ public class UserControllerTest {
        @Test(expected = Exception.class)\r
        public void deleteReservationException4Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -884,8 +903,8 @@ public class UserControllerTest {
        @Test\r
        public void getResourcesTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r
@@ -910,8 +929,8 @@ public class UserControllerTest {
        @Test(expected = Exception.class)\r
        public void getResourcesExceptionTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               UserController uc = new UserController();\r
-               uc.setDataHandler(dh);\r
+               UserController uc = new UserController(dh);\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.logIn("TestUser1", "pass1");\r