warnings fixed
[staff/due1/sed-hs15-srs-purple.git] / src / test / java / ch / bfh / ti / srs / controller / UserControllerTest.java
index 5b06f2a..a63687e 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
@@ -105,12 +107,13 @@ public class UserControllerTest {
                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();\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
@@ -120,18 +123,22 @@ public class UserControllerTest {
                assertEquals("TestUser1", uc.getLoggedUserName());\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @Test(expected = Exception.class)\r
        public void getLoggedUserNameExceptionTest() throws Exception {\r
-               UserController uc = new UserController();\r
-               String currentUserName = uc.getLoggedUserName();\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();\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
@@ -141,18 +148,22 @@ public class UserControllerTest {
                assertEquals("hanfli@bfh.ch", uc.getLoggedMail());\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @Test(expected = Exception.class)\r
        public void getLoggedMailExceptionTest() throws Exception {\r
-               UserController uc = new UserController();\r
-               String currentMail = uc.getLoggedMail();\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();\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
@@ -162,18 +173,22 @@ public class UserControllerTest {
                assertEquals("Hanfli", uc.getLoggedName());\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\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
+       @SuppressWarnings("deprecation")\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
@@ -183,18 +198,21 @@ public class UserControllerTest {
                assertEquals("User", uc.getLoggedLastname());\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @Test(expected = Exception.class)\r
        public void getLoggedLastnameExceptionTest() throws Exception {\r
-               UserController uc = new UserController();\r
-               String currentLastName = uc.getLoggedLastname();\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();\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 +222,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 +232,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,19 +243,21 @@ 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
                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();\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 +271,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 +280,26 @@ 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
+       @SuppressWarnings("deprecation")\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
@@ -292,7 +316,6 @@ public class UserControllerTest {
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
 \r
-               User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
 \r
                Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
@@ -330,65 +353,71 @@ 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
+       @SuppressWarnings("deprecation")\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
@@ -409,11 +438,12 @@ public class UserControllerTest {
                assertEquals(null, uc.makeReservation(null, resource2, dtList, "remark"));\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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
@@ -445,11 +475,12 @@ public class UserControllerTest {
                assertEquals(4, uc.makeReservation(uc.getLoggedUser(), resource1, conflictingList, null).size());\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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
@@ -470,11 +501,12 @@ public class UserControllerTest {
                assertEquals(null, uc.makeReservation(null, resource1, dtList, "remark"));\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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
@@ -494,11 +526,12 @@ public class UserControllerTest {
                assertEquals(null, uc.makeReservation(null, null, dtList, "remark"));\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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 +554,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
@@ -539,11 +572,12 @@ public class UserControllerTest {
                assertEquals(null, uc.makeReservation(null, resource1, dtList, "remark"));\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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
@@ -554,9 +588,6 @@ public class UserControllerTest {
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
 \r
-               User loggedUser = uc.getLoggedUser();\r
-               User testUser2 = uc.getUser("TestUser2");\r
-\r
                Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
                                "Test reservation1");\r
                dh.addReservation(reservation1);\r
@@ -570,11 +601,12 @@ public class UserControllerTest {
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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
@@ -589,9 +621,6 @@ public class UserControllerTest {
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
 \r
-               User loggedUser = uc.getLoggedUser();\r
-               User testUser2 = uc.getUser("TestUser2");\r
-\r
                Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
                                "Test reservation1");\r
                dh.addReservation(reservation1);\r
@@ -608,11 +637,12 @@ public class UserControllerTest {
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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
@@ -627,9 +657,6 @@ public class UserControllerTest {
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
 \r
-               User loggedUser = uc.getLoggedUser();\r
-               User testUser2 = uc.getUser("TestUser2");\r
-\r
                Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
                                "Test reservation1");\r
                dh.addReservation(reservation1);\r
@@ -646,11 +673,12 @@ public class UserControllerTest {
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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
@@ -665,9 +693,6 @@ public class UserControllerTest {
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
 \r
-               User loggedUser = uc.getLoggedUser();\r
-               User testUser2 = uc.getUser("TestUser2");\r
-\r
                Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
                                "Test reservation1");\r
                dh.addReservation(reservation1);\r
@@ -683,11 +708,12 @@ public class UserControllerTest {
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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
@@ -702,9 +728,6 @@ public class UserControllerTest {
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
 \r
-               User loggedUser = uc.getLoggedUser();\r
-               User testUser2 = uc.getUser("TestUser2");\r
-\r
                Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
                                "Test reservation1");\r
                dh.addReservation(reservation1);\r
@@ -722,11 +745,12 @@ public class UserControllerTest {
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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
@@ -741,9 +765,6 @@ public class UserControllerTest {
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
 \r
-               User loggedUser = uc.getLoggedUser();\r
-               User testUser2 = uc.getUser("TestUser2");\r
-\r
                Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
                                "Test reservation1");\r
                dh.addReservation(reservation1);\r
@@ -753,11 +774,12 @@ public class UserControllerTest {
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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
@@ -772,9 +794,6 @@ public class UserControllerTest {
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
 \r
-               User loggedUser = uc.getLoggedUser();\r
-               User testUser2 = uc.getUser("TestUser2");\r
-\r
                Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
                                "Test reservation1");\r
                dh.addReservation(reservation1);\r
@@ -785,11 +804,12 @@ public class UserControllerTest {
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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
@@ -804,9 +824,6 @@ public class UserControllerTest {
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
 \r
-               User loggedUser = uc.getLoggedUser();\r
-               User testUser2 = uc.getUser("TestUser2");\r
-\r
                Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
                                "Test reservation1");\r
                dh.addReservation(reservation1);\r
@@ -817,11 +834,12 @@ public class UserControllerTest {
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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
@@ -836,9 +854,6 @@ public class UserControllerTest {
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
 \r
-               User loggedUser = uc.getLoggedUser();\r
-               User testUser2 = uc.getUser("TestUser2");\r
-\r
                Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
                                "Test reservation1");\r
                dh.addReservation(reservation1);\r
@@ -848,11 +863,12 @@ public class UserControllerTest {
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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
@@ -867,9 +883,6 @@ public class UserControllerTest {
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
 \r
-               User loggedUser = uc.getLoggedUser();\r
-               User testUser2 = uc.getUser("TestUser2");\r
-\r
                Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
                                "Test reservation1");\r
                dh.addReservation(reservation1);\r
@@ -881,11 +894,12 @@ public class UserControllerTest {
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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
@@ -907,11 +921,12 @@ public class UserControllerTest {
                assertEquals(3, resList.size());\r
        }\r
 \r
+       @SuppressWarnings("deprecation")\r
        @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