removed all checkstyle errors, updated sprint backlog
authorDominik <muggd1@bfh.ch>
Sun, 29 Nov 2015 11:48:26 +0000 (12:48 +0100)
committerDominik <muggd1@bfh.ch>
Sun, 29 Nov 2015 11:48:26 +0000 (12:48 +0100)
19 files changed:
src/main/java/ch/bfh/ti/srs/controller/UserController.java
src/main/java/ch/bfh/ti/srs/controller/package-info.java
src/main/java/ch/bfh/ti/srs/datahandler/DataHandler.java
src/main/java/ch/bfh/ti/srs/datahandler/DataHandlerForTests.java
src/main/java/ch/bfh/ti/srs/datahandler/package-info.java
src/main/java/ch/bfh/ti/srs/dataschema/Reservation.java
src/main/java/ch/bfh/ti/srs/dataschema/Resource.java
src/main/java/ch/bfh/ti/srs/dataschema/User.java
src/main/java/ch/bfh/ti/srs/extern/Password.java
src/main/java/ch/bfh/ti/srs/extern/package-info.java
src/main/java/ch/bfh/ti/srs/gui/package-info.java
src/main/java/ch/bfh/ti/srs/noTest/DataHandlerForExcel.java
src/main/java/ch/bfh/ti/srs/noTest/package-info.java
src/site/apt/sprint_backlog.apt
src/test/java/ch/bfh/ti/srs/controller/UserControllerTest.java
src/test/java/ch/bfh/ti/srs/datahandler/DataHandlerForTestsTest.java
src/test/java/ch/bfh/ti/srs/dataschema/ReservationTest.java
src/test/java/ch/bfh/ti/srs/dataschema/ResourceTest.java
src/test/java/ch/bfh/ti/srs/dataschema/UserTest.java

index 49dbbd1..18ce351 100644 (file)
@@ -28,64 +28,81 @@ import ch.bfh.ti.srs.dataschema.User;
 public class UserController {\r
        private User currentUser;\r
        private DataHandler dh;\r
 public class UserController {\r
        private User currentUser;\r
        private DataHandler dh;\r
-       \r
-       public UserController(){\r
+\r
+       public UserController() {\r
        }\r
        }\r
-       \r
+\r
        /**\r
        /**\r
-        * Sets the <code>DataHandler</code> implementation for this Controller, must be set before using all other methods!\r
-        * \r
-        * @param dh    DataHandler implementation (i.e. DataHandlerForExcel)\r
+        * Sets the <code>DataHandler</code> implementation for this Controller,\r
+        * must be set before using all other methods!\r
+        * @param dh\r
+        *            DataHandler implementation (i.e. DataHandlerForExcel)\r
         */\r
         */\r
-       public void setDataHandler(DataHandler dh){\r
+       public void setDataHandler(DataHandler dh) {\r
                this.dh = dh;\r
        }\r
                this.dh = dh;\r
        }\r
-       \r
+\r
        /**\r
         * Tries to log in a <code>User</code> with the given credentials\r
        /**\r
         * Tries to log in a <code>User</code> with the given credentials\r
-        * \r
-        * @param userName                                      user name\r
-        * @param password                                      the stored password for the given user name\r
-        * @return                                                      <code>True</code> if the user could log in successfully,\r
-        *                                                                      <code>False</code> either the username or the password was not correct.\r
-        * @throws Exception                            no <code>DataHandler</code> set\r
-        * @throws AlreadyBoundException        a <code>User</code> is already logged in\r
+        * @param userName\r
+        *            user name\r
+        * @param password\r
+        *            the stored password for the given user name\r
+        * @return <code>True</code> if the user could log in successfully,\r
+        *         <code>False</code> either the username or the password was not\r
+        *         correct.\r
+        * @throws Exception\r
+        *             no <code>DataHandler</code> set\r
+        * @throws AlreadyBoundException\r
+        *             a <code>User</code> is already logged in\r
         */\r
         */\r
-       public boolean logIn(String userName, String password) throws Exception{\r
-               if(dh == null) throw new Exception("No DataHandler set");\r
-               if(currentUser != null) throw new AlreadyBoundException("A user is already logged in");\r
+       public boolean logIn(String userName, String password) throws Exception {\r
+               if (dh == null)\r
+                       throw new Exception("No DataHandler set");\r
+               if (currentUser != null)\r
+                       throw new AlreadyBoundException("A user is already logged in");\r
                User tempUser = dh.findUser(userName);\r
                User tempUser = dh.findUser(userName);\r
-               if(tempUser == null || !tempUser.checkPassword(password)) return false;\r
-               else{\r
+               if (tempUser == null || !tempUser.checkPassword(password))\r
+                       return false;\r
+               else {\r
                        currentUser = tempUser;\r
                        return true;\r
                }\r
        }\r
                        currentUser = tempUser;\r
                        return true;\r
                }\r
        }\r
-       \r
+\r
        /**\r
         * Logs out the current logged user\r
        /**\r
         * Logs out the current logged user\r
-        * \r
-        * @throws Exception either no <code>DataHandler</code> is set or no user is logged in\r
+        * @throws Exception\r
+        *             either no <code>DataHandler</code> is set or no user is\r
+        *             logged in\r
         */\r
         */\r
-       public void logOut() throws Exception{\r
-               if(dh == null) throw new Exception("No DataHandler set");\r
-               if(currentUser == null) throw new Exception("No user is logged in");\r
+       public void logOut() throws Exception {\r
+               if (dh == null)\r
+                       throw new Exception("No DataHandler set");\r
+               if (currentUser == null)\r
+                       throw new Exception("No user is logged in");\r
                currentUser = null;\r
        }\r
                currentUser = null;\r
        }\r
-       \r
+\r
        /**\r
         * Registers a new user to the current DataHandler\r
        /**\r
         * Registers a new user to the current DataHandler\r
-        * \r
-        * @param userName              unique user name\r
-        * @param password              plain-text password\r
-        * @param email                 e-mail address\r
-        * @param name                  name\r
-        * @param lastname              last name\r
-        * @throws Exception    no <code>DataHandler</code> set\r
+        * @param userName\r
+        *            unique user name\r
+        * @param password\r
+        *            plain-text password\r
+        * @param email\r
+        *            e-mail address\r
+        * @param name\r
+        *            name\r
+        * @param lastname\r
+        *            last name\r
+        * @throws Exception\r
+        *             no <code>DataHandler</code> set\r
         */\r
         */\r
-       public void addUser(String userName, String password, String email, String name, String lastname) throws Exception{\r
-               if(dh == null) throw new Exception("No DataHandler set");\r
-               User newUser = new User(userName,password);\r
+       public void addUser(String userName, String password, String email, String name, String lastname) throws Exception {\r
+               if (dh == null)\r
+                       throw new Exception("No DataHandler set");\r
+               User newUser = new User(userName, password);\r
                newUser.setMail(email);\r
                newUser.setName(name);\r
                newUser.setLastname(lastname);\r
                newUser.setMail(email);\r
                newUser.setName(name);\r
                newUser.setLastname(lastname);\r
@@ -94,91 +111,103 @@ public class UserController {
 \r
        /**\r
         * Gets the user name of the current user\r
 \r
        /**\r
         * Gets the user name of the current user\r
-        * \r
-        * @deprecated                  use <code>getLoggedUser().getUserName()</code>\r
-        * @return                              user name\r
-        * @throws      Exception       no <code>DataHandler</code> is set\r
+        * @deprecated use <code>getLoggedUser().getUserName()</code>\r
+        * @return user name\r
+        * @throws Exception\r
+        *             no <code>DataHandler</code> is set\r
         */\r
         */\r
-       @Deprecated \r
-       public String getLoggedUserName() throws Exception{\r
-               if(currentUser == null) throw new Exception("No user is logged in");\r
+       @Deprecated\r
+       public String getLoggedUserName() throws Exception {\r
+               if (currentUser == null)\r
+                       throw new Exception("No user is logged in");\r
                return currentUser.getUserName();\r
        }\r
 \r
        /**\r
         * Gets the mail address of the current user\r
                return currentUser.getUserName();\r
        }\r
 \r
        /**\r
         * Gets the mail address of the current user\r
-        * \r
         * @deprecated use <code>getLoggedUser().getMail()</code>\r
         * @deprecated use <code>getLoggedUser().getMail()</code>\r
-        * @return      Mail address\r
-        * @throws      Exception       no user is logged in\r
+        * @return Mail address\r
+        * @throws Exception\r
+        *             no user is logged in\r
         */\r
        @Deprecated\r
         */\r
        @Deprecated\r
-       public String getLoggedMail() throws Exception{\r
-               if(currentUser == null) throw new Exception("No user is logged in");\r
+       public String getLoggedMail() throws Exception {\r
+               if (currentUser == null)\r
+                       throw new Exception("No user is logged in");\r
                return currentUser.getMail();\r
        }\r
 \r
        /**\r
         * Gets the first name of the current user\r
                return currentUser.getMail();\r
        }\r
 \r
        /**\r
         * Gets the first name of the current user\r
-        * \r
         * @deprecated use <code>getLoggedUser().getName()</code>\r
         * @deprecated use <code>getLoggedUser().getName()</code>\r
-        * @return      First name\r
-        * @throws      Exception       no user is logged in\r
+        * @return First name\r
+        * @throws Exception\r
+        *             no user is logged in\r
         */\r
        @Deprecated\r
         */\r
        @Deprecated\r
-       public String getLoggedName() throws Exception{\r
-               if(currentUser == null) throw new Exception("No user is logged in");\r
+       public String getLoggedName() throws Exception {\r
+               if (currentUser == null)\r
+                       throw new Exception("No user is logged in");\r
                return currentUser.getName();\r
        }\r
 \r
        /**\r
         * Gets the last name of the current user\r
                return currentUser.getName();\r
        }\r
 \r
        /**\r
         * Gets the last name of the current user\r
-        * \r
         * @deprecated use <code>getLoggedUser().getLastName()</code>\r
         * @deprecated use <code>getLoggedUser().getLastName()</code>\r
-        * @return      Last name\r
-        * @throws      Exception       no user is logged in\r
+        * @return Last name\r
+        * @throws Exception\r
+        *             no user is logged in\r
         */\r
        @Deprecated\r
         */\r
        @Deprecated\r
-       public String getLoggedLastname() throws Exception{\r
-               if(currentUser == null) throw new Exception("No user is logged in");\r
+       public String getLoggedLastname() throws Exception {\r
+               if (currentUser == null)\r
+                       throw new Exception("No user is logged in");\r
                return currentUser.getLastname();\r
        }\r
                return currentUser.getLastname();\r
        }\r
-       \r
+\r
        /**\r
         * Gets the current logged <code>User</code>\r
        /**\r
         * Gets the current logged <code>User</code>\r
-        * \r
-        * @return      current <code>User</code>, or <code>null</code> if no <code>User</code> is logged in\r
+        * @return current <code>User</code>, or <code>null</code> if no\r
+        *         <code>User</code> is logged in\r
         */\r
         */\r
-       public User getLoggedUser(){\r
-               if(currentUser == null) return null;\r
+       public User getLoggedUser() {\r
+               if (currentUser == null)\r
+                       return null;\r
                return currentUser;\r
        }\r
                return currentUser;\r
        }\r
-       \r
+\r
        /**\r
         * Searches the set DataHandler for a specific <code>User</code>\r
        /**\r
         * Searches the set DataHandler for a specific <code>User</code>\r
-        * \r
-        * @param userName              <code>User</code>\r
-        * @return                              clone of <code>User</code>\r
-        * @throws Exception    No <code>DataHandler</code> is set\r
+        * @param userName\r
+        *            <code>User</code>\r
+        * @return clone of <code>User</code>\r
+        * @throws Exception\r
+        *             No <code>DataHandler</code> is set\r
         */\r
         */\r
-       public User getUser(String userName) throws Exception{\r
-               if(dh == null) throw new Exception("No DataHandler set");\r
+       public User getUser(String userName) throws Exception {\r
+               if (dh == null)\r
+                       throw new Exception("No DataHandler set");\r
                return dh.findUser(userName).clone();\r
        }\r
                return dh.findUser(userName).clone();\r
        }\r
-       \r
+\r
        /**\r
        /**\r
-        * Returns all reservations overlapping the given dateRange in a <code>Map</code>\r
-        * \r
-        * @param       dateRange       time span\r
-        * @return                              <code>Key</code> reservation, \r
-        *                                              <code>Value</code> is editable\r
-        * @throws      Exception       no <code>User</code> is logged in or no <code>DataHandler</code> is set\r
+        * Returns all reservations overlapping the given dateRange in a\r
+        * <code>Map</code>\r
+        * @param dateRange\r
+        *            time span\r
+        * @return <code>Key</code> reservation, <code>Value</code> is editable\r
+        * @throws Exception\r
+        *             no <code>User</code> is logged in or no\r
+        *             <code>DataHandler</code> is set\r
         */\r
         */\r
-       public Map<Reservation, Boolean> getReservationsInDateRange(DateRange dateRange) throws Exception{\r
-               if(dh == null) throw new Exception("No DataHandler set");\r
-               if(dateRange == null) throw new Exception("dateRange must be defined");\r
-               \r
-               // Could be swapped out to private method for better performance (just check currentUser once)\r
+       public Map<Reservation, Boolean> getReservationsInDateRange(DateRange dateRange) throws Exception {\r
+               if (dh == null)\r
+                       throw new Exception("No DataHandler set");\r
+               if (dateRange == null)\r
+                       throw new Exception("dateRange must be defined");\r
+\r
+               // Could be swapped out to private method for better performance (just\r
+               // check currentUser once)\r
                // and easier code maintenance\r
                Map<Reservation, Boolean> returnSet = new HashMap<Reservation, Boolean>();\r
                for (Reservation reservation : dh.overlaps(dateRange)) {\r
                // and easier code maintenance\r
                Map<Reservation, Boolean> returnSet = new HashMap<Reservation, Boolean>();\r
                for (Reservation reservation : dh.overlaps(dateRange)) {\r
@@ -186,37 +215,49 @@ public class UserController {
                }\r
                return returnSet;\r
        }\r
                }\r
                return returnSet;\r
        }\r
-       \r
+\r
        /**\r
         * Returns the reservation or null if no reservation was found\r
        /**\r
         * Returns the reservation or null if no reservation was found\r
-        * \r
-        * @param id                    reservation identifier\r
-        * @return                              <code>Reservation</code> copy of reservation with given id, \r
-        *                                              <code>null</code> no reservation with this id found\r
-        * @throws Exception    No DataHandler set or id null\r
+        * @param id\r
+        *            reservation identifier\r
+        * @return <code>Reservation</code> copy of reservation with given id,\r
+        *         <code>null</code> no reservation with this id found\r
+        * @throws Exception\r
+        *             No DataHandler set or id null\r
         */\r
         */\r
-       public Reservation getReservation(UUID id) throws Exception{\r
-               if(dh == null) throw new Exception("No DataHandler set");\r
-               if(id == null) throw new Exception("uuid must be defined");\r
-               if(dh.findReservation(id) == null) return null;\r
-               else return dh.findReservation(id).clone();\r
+       public Reservation getReservation(UUID id) throws Exception {\r
+               if (dh == null)\r
+                       throw new Exception("No DataHandler set");\r
+               if (id == null)\r
+                       throw new Exception("uuid must be defined");\r
+               if (dh.findReservation(id) == null)\r
+                       return null;\r
+               else\r
+                       return dh.findReservation(id).clone();\r
        }\r
        }\r
-       \r
+\r
        /**\r
         * Returns the reservations of the given user\r
        /**\r
         * Returns the reservations of the given user\r
-        * \r
-        * @param user                          Owner, if <code>null</code> returns the reservations of the current logged in user\r
-        * @return                                      <code>List</code> of reservation copies of the given owner\r
-        * @throws Exception            either no <code>DataHandler</code> is set or no user is logged in while user param = null\r
+        * @param user\r
+        *            Owner, if <code>null</code> returns the reservations of the\r
+        *            current logged in user\r
+        * @return <code>List</code> of reservation copies of the given owner\r
+        * @throws Exception\r
+        *             either no <code>DataHandler</code> is set or no user is\r
+        *             logged in while user param = null\r
         */\r
         */\r
-       public Map<Reservation, Boolean> getUserReservations(User user) throws Exception{\r
-               if(dh == null) throw new Exception("No DataHandler set");\r
-               if(user == null){\r
-                       if(currentUser == null) throw new Exception("user must be defined, if no user is logged in");\r
-                       else user = currentUser;\r
+       public Map<Reservation, Boolean> getUserReservations(User user) throws Exception {\r
+               if (dh == null)\r
+                       throw new Exception("No DataHandler set");\r
+               if (user == null) {\r
+                       if (currentUser == null)\r
+                               throw new Exception("user must be defined, if no user is logged in");\r
+                       else\r
+                               user = currentUser;\r
                }\r
                }\r
-               \r
-               // Could be swapped out to private method for better performance (just check currentUser once)\r
+\r
+               // Could be swapped out to private method for better performance (just\r
+               // check currentUser once)\r
                // and easier code maintenance\r
                Map<Reservation, Boolean> returnSet = new HashMap<Reservation, Boolean>();\r
                for (Reservation reservation : dh.userReservations(user)) {\r
                // and easier code maintenance\r
                Map<Reservation, Boolean> returnSet = new HashMap<Reservation, Boolean>();\r
                for (Reservation reservation : dh.userReservations(user)) {\r
@@ -224,21 +265,25 @@ public class UserController {
                }\r
                return returnSet;\r
        }\r
                }\r
                return returnSet;\r
        }\r
-       \r
+\r
        /**\r
         * Returns <code>Map</code> of reservation group (recurring reservations)\r
        /**\r
         * Returns <code>Map</code> of reservation group (recurring reservations)\r
-        * \r
-        * @param groupId                                       group identifier\r
-        * @return                                                      <code>Key</code> reservation, \r
-        *                                                                      <code>Value</code> is editable\r
-        * @throws IllegalArgumentException     groupId is null\r
-        * @throws Exception                            no <code>DataHandler</code> set\r
+        * @param groupId\r
+        *            group identifier\r
+        * @return <code>Key</code> reservation, <code>Value</code> is editable\r
+        * @throws IllegalArgumentException\r
+        *             groupId is null\r
+        * @throws Exception\r
+        *             no <code>DataHandler</code> set\r
         */\r
         */\r
-       public Map<Reservation, Boolean> getReservationGroup(UUID groupId) throws Exception{\r
-               if(dh == null) throw new Exception("No DataHandler set");\r
-               if(groupId == null) throw new IllegalArgumentException("groupId has to be defined");\r
-               \r
-               // Could be swapped out to private method for better performance (just check currentUser once)\r
+       public Map<Reservation, Boolean> getReservationGroup(UUID groupId) throws Exception {\r
+               if (dh == null)\r
+                       throw new Exception("No DataHandler set");\r
+               if (groupId == null)\r
+                       throw new IllegalArgumentException("groupId has to be defined");\r
+\r
+               // Could be swapped out to private method for better performance (just\r
+               // check currentUser once)\r
                // and easier code maintenance\r
                Map<Reservation, Boolean> returnSet = new HashMap<Reservation, Boolean>();\r
                for (Reservation reservation : dh.findGroupReservations(groupId)) {\r
                // and easier code maintenance\r
                Map<Reservation, Boolean> returnSet = new HashMap<Reservation, Boolean>();\r
                for (Reservation reservation : dh.findGroupReservations(groupId)) {\r
@@ -249,84 +294,110 @@ public class UserController {
 \r
        /**\r
         * Makes a reservation in the current set DataHandler\r
 \r
        /**\r
         * Makes a reservation in the current set DataHandler\r
-        * \r
-        * @param user                                                  user owning the reservation, if null currentUser is set\r
-        * @param resource                                              resource to reserve\r
-        * @param dateRangeList                                 <code>List</code> of DateRanges defining when the resource is occupied\r
-        * @param remark                                                public remark for the reservation\r
-        * @return                                                              <code>Set</code> of Reservations that overlap an already stored reservation (conflict), if not empty no reservation was saved\r
-        * @throws IllegalArgumentException             <code>resource</code> or <code>dateRangeList</code> is null, or <code>dateRangeList</code> is empty\r
-        * @throws Exception                                    thrown by <code>DataHandler</code>\r
+        * @param user\r
+        *            user owning the reservation, if null currentUser is set\r
+        * @param resource\r
+        *            resource to reserve\r
+        * @param dateRangeList\r
+        *            <code>List</code> of DateRanges defining when the resource is\r
+        *            occupied\r
+        * @param remark\r
+        *            public remark for the reservation\r
+        * @return <code>Set</code> of Reservations that overlap an already stored\r
+        *         reservation (conflict), if not empty no reservation was saved\r
+        * @throws IllegalArgumentException\r
+        *             <code>resource</code> or <code>dateRangeList</code> is null,\r
+        *             or <code>dateRangeList</code> is empty\r
+        * @throws Exception\r
+        *             thrown by <code>DataHandler</code>\r
         */\r
         */\r
-       public Set<Reservation> makeReservation(User user, Resource resource, List<DateRange> dateRangeList, String remark) throws Exception\r
-       {\r
-               if(user == null){\r
-                       if(currentUser == null) throw new IllegalArgumentException("User must be defined if no user is logged in");\r
+       public Set<Reservation> makeReservation(User user, Resource resource, List<DateRange> dateRangeList, String remark)\r
+                       throws Exception {\r
+               if (user == null) {\r
+                       if (currentUser == null)\r
+                               throw new IllegalArgumentException("User must be defined if no user is logged in");\r
                        user = currentUser;\r
                }\r
                        user = currentUser;\r
                }\r
-               if(resource == null) throw new IllegalArgumentException("Resource must be definded");\r
-               if(dateRangeList == null) throw new IllegalArgumentException("dateRangeList can not be null");\r
-               if(dateRangeList.isEmpty()) throw new IllegalArgumentException("dateRangeList empty");\r
-               \r
+               if (resource == null)\r
+                       throw new IllegalArgumentException("Resource must be definded");\r
+               if (dateRangeList == null)\r
+                       throw new IllegalArgumentException("dateRangeList can not be null");\r
+               if (dateRangeList.isEmpty())\r
+                       throw new IllegalArgumentException("dateRangeList empty");\r
+\r
                Set<Reservation> invalidReservations = new HashSet<Reservation>();\r
                UUID groupId = UUID.randomUUID();\r
                for (DateRange dateRange : dateRangeList) {\r
                        Reservation reservation = new Reservation(groupId, user, resource, dateRange, remark);\r
                Set<Reservation> invalidReservations = new HashSet<Reservation>();\r
                UUID groupId = UUID.randomUUID();\r
                for (DateRange dateRange : dateRangeList) {\r
                        Reservation reservation = new Reservation(groupId, user, resource, dateRange, remark);\r
-                       if(!dh.addReservation(reservation)) invalidReservations.add(reservation);\r
+                       if (!dh.addReservation(reservation))\r
+                               invalidReservations.add(reservation);\r
                }\r
                }\r
-               if(invalidReservations.isEmpty())\r
-                       {\r
-                               dh.saveChanges();\r
-                               return null;\r
-                       }\r
-               else return invalidReservations;\r
+               if (invalidReservations.isEmpty()) {\r
+                       dh.saveChanges();\r
+                       return null;\r
+               } else\r
+                       return invalidReservations;\r
        }\r
        }\r
-       \r
+\r
        /**\r
        /**\r
-        * Replaces the given reservation in the set DataHandler referring to the reservationid\r
-        * \r
-        * @param reservation                           Copy of the reservation to edit\r
-        * @return                                                      <code>True</code> Changes saved, \r
-        *                                                                      <code>False</code> Changes could not be saved\r
-        * @throws IllegalArgumentException     if reservation param is null\r
-        * @throws Exception                            if no <code>DataHandler</code> is set or the logged user is not authorized\r
+        * Replaces the given reservation in the set DataHandler referring to the\r
+        * reservationid\r
+        * @param reservation\r
+        *            Copy of the reservation to edit\r
+        * @return <code>True</code> Changes saved, <code>False</code> Changes could\r
+        *         not be saved\r
+        * @throws IllegalArgumentException\r
+        *             if reservation param is null\r
+        * @throws Exception\r
+        *             if no <code>DataHandler</code> is set or the logged user is\r
+        *             not authorized\r
         */\r
         */\r
-       public boolean changeReservation(Reservation reservation) throws Exception\r
-       {\r
-               if(dh == null) throw new Exception("No DataHandler set");\r
-               if(currentUser == null) throw new Exception("No user is logged in");\r
-               if(reservation == null) throw new IllegalArgumentException("Reservation must be defined");\r
-               if(!reservation.getUser().equals(currentUser)) throw new Exception("You are not authorized to make this change");\r
+       public boolean changeReservation(Reservation reservation) throws Exception {\r
+               if (dh == null)\r
+                       throw new Exception("No DataHandler set");\r
+               if (currentUser == null)\r
+                       throw new Exception("No user is logged in");\r
+               if (reservation == null)\r
+                       throw new IllegalArgumentException("Reservation must be defined");\r
+               if (!reservation.getUser().equals(currentUser))\r
+                       throw new Exception("You are not authorized to make this change");\r
                return dh.editReservation(reservation);\r
        }\r
                return dh.editReservation(reservation);\r
        }\r
-       \r
+\r
        /**\r
        /**\r
-        * Deletes the given reservation in the set <code>DataHandler</code> referring to the reservation id\r
-        * \r
-        * @param reservation                           Copy of the reservation to edit\r
-        * @return                                                      <code>True</code> Changes saved\r
-        *                                                                      <code>False</code> Changes could not be saved\r
-        * @throws IllegalArgumentException     if reservation is null\r
-        * @throws Exception                            if no <code>DataHandler</code> is set, no <code>User</code> is logged in or logged <code>User</code> is not authorized\r
+        * Deletes the given reservation in the set <code>DataHandler</code>\r
+        * referring to the reservation id\r
+        * @param reservation\r
+        *            Copy of the reservation to edit\r
+        * @return <code>True</code> Changes saved <code>False</code> Changes could\r
+        *         not be saved\r
+        * @throws IllegalArgumentException\r
+        *             if reservation is null\r
+        * @throws Exception\r
+        *             if no <code>DataHandler</code> is set, no <code>User</code>\r
+        *             is logged in or logged <code>User</code> is not authorized\r
         */\r
         */\r
-       public boolean deleteReservation(Reservation reservation) throws Exception\r
-       {\r
-               if(dh == null) throw new Exception("No DataHandler set");\r
-               if(currentUser == null) throw new Exception("No user is logged in");\r
-               if(reservation == null) throw new IllegalArgumentException("Reservation must be defined");\r
-               if(!reservation.getUser().equals(currentUser)) throw new Exception("You are not authorized to make this change");\r
+       public boolean deleteReservation(Reservation reservation) throws Exception {\r
+               if (dh == null)\r
+                       throw new Exception("No DataHandler set");\r
+               if (currentUser == null)\r
+                       throw new Exception("No user is logged in");\r
+               if (reservation == null)\r
+                       throw new IllegalArgumentException("Reservation must be defined");\r
+               if (!reservation.getUser().equals(currentUser))\r
+                       throw new Exception("You are not authorized to make this change");\r
                return dh.deleteReservation(reservation);\r
        }\r
                return dh.deleteReservation(reservation);\r
        }\r
-       \r
-       \r
+\r
        /**\r
         * Returns all stored resources of the set DataHandler\r
        /**\r
         * Returns all stored resources of the set DataHandler\r
-        * \r
-        * @return                              <code>List</code> of resources\r
-        * @throws Exception    no <code>DataHandler</code> is set\r
+        * @return <code>List</code> of resources\r
+        * @throws Exception\r
+        *             no <code>DataHandler</code> is set\r
         */\r
         */\r
-       public List<Resource> getResources() throws Exception{\r
-               if(dh == null) throw new Exception("No DataHandler set");\r
+       public List<Resource> getResources() throws Exception {\r
+               if (dh == null)\r
+                       throw new Exception("No DataHandler set");\r
                List<Resource> resourceList = new ArrayList<Resource>();\r
                for (Resource resource : dh.getAllResources()) {\r
                        resourceList.add(resource.clone());\r
                List<Resource> resourceList = new ArrayList<Resource>();\r
                for (Resource resource : dh.getAllResources()) {\r
                        resourceList.add(resource.clone());\r
index b588a18..29db05e 100644 (file)
@@ -6,7 +6,3 @@
  * Distributable under GPL license. See terms of license at gnu.org.\r
  */\r
 package ch.bfh.ti.srs.controller;\r
  * Distributable under GPL license. See terms of license at gnu.org.\r
  */\r
 package ch.bfh.ti.srs.controller;\r
-\r
-/*\r
- * \r
- */
\ No newline at end of file
index 5172caa..e861f0e 100644 (file)
@@ -36,8 +36,9 @@ public interface DataHandler {
         * @param user
         *            User object
         * @return returns a boolean whether the user was made or not
         * @param user
         *            User object
         * @return returns a boolean whether the user was made or not
-        * @throws Exception if some property of the specified element
-     *         prevents it from being added the Datacontext
+        * @throws Exception
+        *             if some property of the specified element prevents it from
+        *             being added the Datacontext
         */
        public boolean addUser(User user) throws Exception;
 
         */
        public boolean addUser(User user) throws Exception;
 
@@ -56,8 +57,9 @@ public interface DataHandler {
         * @param resource
         *            Resource object
         * @return returns a boolean whether the resource was made or not
         * @param resource
         *            Resource object
         * @return returns a boolean whether the resource was made or not
-        * @throws Exception if some property of the specified element
-     *         prevents it from being added the Datacontext
+        * @throws Exception
+        *             if some property of the specified element prevents it from
+        *             being added the Datacontext
         */
        public boolean addResource(Resource resource) throws Exception;
 
         */
        public boolean addResource(Resource resource) throws Exception;
 
@@ -99,8 +101,7 @@ public interface DataHandler {
 
        /**
         * Finds all reservations
 
        /**
         * Finds all reservations
-        * @return <code>List</code> with the all reservation
-        *         objects
+        * @return <code>List</code> with the all reservation objects
         */
        public List<Reservation> findAllReservations();
 
         */
        public List<Reservation> findAllReservations();
 
@@ -108,29 +109,29 @@ public interface DataHandler {
         * Adds a reservation to the Datacontext from a given Reservation object
         * @param reservation
         *            Reservation object
         * Adds a reservation to the Datacontext from a given Reservation object
         * @param reservation
         *            Reservation object
-        *            
         * @return a boolean whether the reservation was made or not
         * @return a boolean whether the reservation was made or not
-        * @throws Exception if some property of the specified element
-     *         prevents it from being added the Datacontext
+        * @throws Exception
+        *             if some property of the specified element prevents it from
+        *             being added the Datacontext
         */
        public boolean addReservation(Reservation reservation) throws Exception;
         */
        public boolean addReservation(Reservation reservation) throws Exception;
-       
+
        /**
         * Saves the current changes on the local data to the datastorage
         */
        public void saveChanges();
        /**
         * Saves the current changes on the local data to the datastorage
         */
        public void saveChanges();
-       
+
        /**
         * Synchronizes the local data with the datastorage
        /**
         * Synchronizes the local data with the datastorage
-        * 
         * @param discardChanges
         * @param discardChanges
-        *                      <code>true</code> do not try to save the changes
-        *                      <code>false</code> try to save the changes
-        * @throws Exception no implementation for <code>true</code> in this DataHandler possible
+        *            <code>true</code> do not try to save the changes
+        *            <code>false</code> try to save the changes
+        * @throws Exception
+        *             no implementation for <code>true</code> in this DataHandler
+        *             possible
         */
        public void refresh(boolean discardChanges) throws Exception;
 
         */
        public void refresh(boolean discardChanges) throws Exception;
 
-
        public boolean editReservation(Reservation reservation);
 
        public boolean deleteReservation(Reservation reservation);
        public boolean editReservation(Reservation reservation);
 
        public boolean deleteReservation(Reservation reservation);
index f699888..18229b5 100644 (file)
@@ -44,13 +44,11 @@ public class DataHandlerForTests implements DataHandler {
         */
        @Override
        public boolean addUser(User user) throws Exception {
         */
        @Override
        public boolean addUser(User user) throws Exception {
-               if (user == null){
+               if (user == null) {
                        throw new IllegalArgumentException("User object must not be null!");
                        throw new IllegalArgumentException("User object must not be null!");
-               }
-               else if (userList.contains(user)){
+               } else if (userList.contains(user)) {
                        return false;
                        return false;
-               }
-               else{
+               } else {
                        userList.add(user);
                        return true;
                }
                        userList.add(user);
                        return true;
                }
@@ -73,15 +71,13 @@ public class DataHandlerForTests implements DataHandler {
         */
        @Override
        public boolean addResource(Resource resource) throws Exception {
         */
        @Override
        public boolean addResource(Resource resource) throws Exception {
-               if (resource == null){
+               if (resource == null) {
                        throw new IllegalArgumentException("Resource object must not be null!");
                        throw new IllegalArgumentException("Resource object must not be null!");
-               }
-               else if (resourceList.contains(resource)){
+               } else if (resourceList.contains(resource)) {
                        return false;
                        return false;
-               }
-               else{
+               } else {
                        for (Resource res : resourceList) {
                        for (Resource res : resourceList) {
-                               if (res.getId() == resource.getId()){
+                               if (res.getId() == resource.getId()) {
                                        return false;
                                }
                        }
                                        return false;
                                }
                        }
@@ -164,18 +160,16 @@ public class DataHandlerForTests implements DataHandler {
         */
        @Override
        public boolean addReservation(Reservation reservation) throws Exception {
         */
        @Override
        public boolean addReservation(Reservation reservation) throws Exception {
-               if (reservation == null){
+               if (reservation == null) {
                        throw new IllegalArgumentException("Reservation object must not be null!");
                        throw new IllegalArgumentException("Reservation object must not be null!");
-               }
-               else if(reservationList.contains(reservation)) {
+               } else if (reservationList.contains(reservation)) {
                        return false;
                        return false;
-               }
-               else{
+               } else {
                        for (Reservation res : reservationList) {
                        for (Reservation res : reservationList) {
-                               if (res.getId() == reservation.getId()){
+                               if (res.getId() == reservation.getId()) {
                                        return false;
                                        return false;
-                               }
-                               else if(res.getResource() == reservation.getResource() && res.getDateRange().overlaps(reservation.getDateRange())){
+                               } else if (res.getResource() == reservation.getResource()
+                                               && res.getDateRange().overlaps(reservation.getDateRange())) {
                                        return false;
                                }
                        }
                                        return false;
                                }
                        }
@@ -193,19 +187,21 @@ public class DataHandlerForTests implements DataHandler {
 
        /**
         * {@inheritDoc}
 
        /**
         * {@inheritDoc}
-        * @throws Exception no implementation for <code>true</code> possible
+        * @throws Exception
+        *             no implementation for <code>true</code> possible
         */
        @Override
        public void refresh(boolean discardChanges) throws Exception {
         */
        @Override
        public void refresh(boolean discardChanges) throws Exception {
-               if(discardChanges == true) throw new Exception("No implementation on DataHandlerForTests possible");
+               if (discardChanges == true)
+                       throw new Exception("No implementation on DataHandlerForTests possible");
        }
 
        @Override
        public boolean editReservation(Reservation reservation) {
        }
 
        @Override
        public boolean editReservation(Reservation reservation) {
-               if (reservation == null){
+               if (reservation == null) {
                        throw new IllegalArgumentException("Reservation object must not be null!");
                }
                        throw new IllegalArgumentException("Reservation object must not be null!");
                }
-               if(findReservation(reservation.getId()) != null){
+               if (findReservation(reservation.getId()) != null) {
                        reservationList.remove(findReservation(reservation.getId()));
                        reservationList.add(reservation);
                        return true;
                        reservationList.remove(findReservation(reservation.getId()));
                        reservationList.add(reservation);
                        return true;
@@ -215,14 +211,12 @@ public class DataHandlerForTests implements DataHandler {
 
        @Override
        public boolean deleteReservation(Reservation reservation) {
 
        @Override
        public boolean deleteReservation(Reservation reservation) {
-               if (reservation == null){
+               if (reservation == null) {
                        throw new IllegalArgumentException("Reservation object must not be null!");
                        throw new IllegalArgumentException("Reservation object must not be null!");
-               }
-               else if(reservationList.contains(reservation)) {
+               } else if (reservationList.contains(reservation)) {
                        reservationList.remove(reservation);
                        return true;
                        reservationList.remove(reservation);
                        return true;
-               }
-               else{
+               } else {
                        return false;
                }
        }
                        return false;
                }
        }
index 76f744b..a9b6ab2 100644 (file)
@@ -8,5 +8,6 @@
 package ch.bfh.ti.srs.datahandler;\r
 \r
 /*\r
 package ch.bfh.ti.srs.datahandler;\r
 \r
 /*\r
- * Handlers for accessing and storing data, all handlers have to implement DataHandler interface\r
- */
\ No newline at end of file
+ * Handlers for accessing and storing data, all handlers have to implement\r
+ * DataHandler interface\r
+ */\r
index 5433043..fd7da2b 100644 (file)
@@ -11,7 +11,7 @@ import java.util.UUID;
 \r
 import ch.bfh.ti.daterange.DateRange;\r
 \r
 \r
 import ch.bfh.ti.daterange.DateRange;\r
 \r
-public class Reservation implements Cloneable{\r
+public class Reservation implements Cloneable {\r
 \r
        private UUID id;\r
        private UUID groupId;\r
 \r
        private UUID id;\r
        private UUID groupId;\r
@@ -21,32 +21,32 @@ public class Reservation implements Cloneable{
        private String remark;\r
 \r
        public Reservation(UUID groupId, User user, Resource resource, DateRange DateRange, String remark) {\r
        private String remark;\r
 \r
        public Reservation(UUID groupId, User user, Resource resource, DateRange DateRange, String remark) {\r
-//             // if (groupId == null)\r
-//             // throw new IllegalArgumentException("GroupID must not be null");\r
-//             if (user.getUserName() == null)\r
-//                     throw new IllegalArgumentException("User must not be null");\r
-//             if (resource.getId() == null)\r
-//                     throw new IllegalArgumentException("Resource must not be null");\r
-//             if (dateRange.isEmpty())\r
-//                     throw new IllegalArgumentException("DateRange must not be null");\r
+               // // if (groupId == null)\r
+               // // throw new IllegalArgumentException("GroupID must not be null");\r
+               // if (user.getUserName() == null)\r
+               // throw new IllegalArgumentException("User must not be null");\r
+               // if (resource.getId() == null)\r
+               // throw new IllegalArgumentException("Resource must not be null");\r
+               // if (dateRange.isEmpty())\r
+               // throw new IllegalArgumentException("DateRange must not be null");\r
 \r
                this.groupId = groupId;\r
                this.user = user;\r
                this.resource = resource;\r
                this.dateRange = DateRange;\r
                this.remark = remark;\r
 \r
                this.groupId = groupId;\r
                this.user = user;\r
                this.resource = resource;\r
                this.dateRange = DateRange;\r
                this.remark = remark;\r
-               \r
+\r
                this.id = UUID.randomUUID();\r
        }\r
 \r
        public UUID getId() {\r
                return id;\r
        }\r
                this.id = UUID.randomUUID();\r
        }\r
 \r
        public UUID getId() {\r
                return id;\r
        }\r
-       \r
+\r
        public UUID getGroupId() {\r
                return groupId;\r
        }\r
        public UUID getGroupId() {\r
                return groupId;\r
        }\r
-       \r
+\r
        public User getUser() {\r
                return user;\r
        }\r
        public User getUser() {\r
                return user;\r
        }\r
@@ -62,11 +62,11 @@ public class Reservation implements Cloneable{
        public String getRemark() {\r
                return remark;\r
        }\r
        public String getRemark() {\r
                return remark;\r
        }\r
-       \r
+\r
        public void setUser(User user) {\r
                this.user = user;\r
        }\r
        public void setUser(User user) {\r
                this.user = user;\r
        }\r
\r
+\r
        public void setResource(Resource resource) {\r
                this.resource = resource;\r
        }\r
        public void setResource(Resource resource) {\r
                this.resource = resource;\r
        }\r
@@ -78,9 +78,9 @@ public class Reservation implements Cloneable{
        public void setRemark(String remark) {\r
                this.remark = remark;\r
        }\r
        public void setRemark(String remark) {\r
                this.remark = remark;\r
        }\r
-       \r
+\r
        @Override\r
        public Reservation clone() throws CloneNotSupportedException {\r
        @Override\r
        public Reservation clone() throws CloneNotSupportedException {\r
-        return (Reservation)super.clone();\r
-    }\r
+               return (Reservation) super.clone();\r
+       }\r
 }\r
 }\r
index b518fe0..e5b1ebe 100644 (file)
@@ -9,7 +9,7 @@ package ch.bfh.ti.srs.dataschema;
 \r
 import java.util.UUID;\r
 \r
 \r
 import java.util.UUID;\r
 \r
-public class Resource implements Cloneable{\r
+public class Resource implements Cloneable {\r
 \r
        private UUID id;\r
        private String name;\r
 \r
        private UUID id;\r
        private String name;\r
@@ -17,10 +17,12 @@ public class Resource implements Cloneable{
 \r
        /**\r
         * Normal constructor for new resources created in the UserController\r
 \r
        /**\r
         * Normal constructor for new resources created in the UserController\r
-        * \r
-        * @param name this is the name of the resource\r
-        * @param type this is the type for example school,meeting room...\r
-        * @throws Exception the name of the resource can't be null\r
+        * @param name\r
+        *            this is the name of the resource\r
+        * @param type\r
+        *            this is the type for example school,meeting room...\r
+        * @throws Exception\r
+        *             the name of the resource can't be null\r
         */\r
 \r
        public Resource(String name, String type) throws Exception {\r
         */\r
 \r
        public Resource(String name, String type) throws Exception {\r
@@ -52,9 +54,9 @@ public class Resource implements Cloneable{
        public void setType(String type) {\r
                this.type = type;\r
        }\r
        public void setType(String type) {\r
                this.type = type;\r
        }\r
-       \r
+\r
        @Override\r
        public Resource clone() throws CloneNotSupportedException {\r
        @Override\r
        public Resource clone() throws CloneNotSupportedException {\r
-        return (Resource)super.clone();\r
-    }\r
+               return (Resource) super.clone();\r
+       }\r
 }\r
 }\r
index 82301eb..19bfabb 100644 (file)
@@ -11,7 +11,7 @@ import ch.bfh.ti.srs.extern.Password;
 import java.util.HashSet;
 import java.util.Set;
 
 import java.util.HashSet;
 import java.util.Set;
 
-public class User implements Cloneable{
+public class User implements Cloneable {
 
        private final String userName;
        private String hashedPassword;
 
        private final String userName;
        private String hashedPassword;
@@ -51,7 +51,8 @@ public class User implements Cloneable{
         *            password
         * @throws IllegalArgumentException
         *             user name or password does not meet requirements
         *            password
         * @throws IllegalArgumentException
         *             user name or password does not meet requirements
-        * @throws Exception thrown by <code>Password</code> class
+        * @throws Exception
+        *             thrown by <code>Password</code> class
         */
        public User(String userName, String password) throws Exception {
                if (userName == null)
         */
        public User(String userName, String password) throws Exception {
                if (userName == null)
@@ -105,11 +106,14 @@ public class User implements Cloneable{
 
        /**
         * Checks if the given password matches the hashedPassword
 
        /**
         * Checks if the given password matches the hashedPassword
-        * 
-        * @param password      password to check
-        * @return      <code>True</code> password accepted, <code>False</code> password rejected
-        * @throws IllegalArgumentException     password is null
-        * @throws Exception thrown by <code>Password</code> class
+        * @param password
+        *            password to check
+        * @return <code>True</code> password accepted, <code>False</code> password
+        *         rejected
+        * @throws IllegalArgumentException
+        *             password is null
+        * @throws Exception
+        *             thrown by <code>Password</code> class
         */
        public boolean checkPassword(String password) throws Exception {
                if (password == null)
         */
        public boolean checkPassword(String password) throws Exception {
                if (password == null)
@@ -119,10 +123,12 @@ public class User implements Cloneable{
 
        /**
         * Changes the current password
 
        /**
         * Changes the current password
-        * 
-        * @param newPassword   new password
-        * @throws IllegalArgumentException     password does not meet the requirements
-        * @throws Exception thrown by <code>Password</code> class
+        * @param newPassword
+        *            new password
+        * @throws IllegalArgumentException
+        *             password does not meet the requirements
+        * @throws Exception
+        *             thrown by <code>Password</code> class
         */
        public void changePassword(String newPassword) throws Exception {
                if (newPassword == null)
         */
        public void changePassword(String newPassword) throws Exception {
                if (newPassword == null)
@@ -153,4 +159,4 @@ public class User implements Cloneable{
        public User clone() throws CloneNotSupportedException {
                return (User) super.clone();
        }
        public User clone() throws CloneNotSupportedException {
                return (User) super.clone();
        }
-}
\ No newline at end of file
+}
index 0c6089f..6a3272b 100644 (file)
@@ -1,3 +1,10 @@
+/*\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.extern;\r
 \r
 import javax.crypto.SecretKey;\r
 package ch.bfh.ti.srs.extern;\r
 \r
 import javax.crypto.SecretKey;\r
@@ -7,43 +14,43 @@ import java.security.SecureRandom;
 import org.apache.commons.codec.binary.Base64;\r
 \r
 public class Password {\r
 import org.apache.commons.codec.binary.Base64;\r
 \r
 public class Password {\r
-    // The higher the number of iterations the more \r
-    // expensive computing the hash is for us and\r
-    // also for an attacker.\r
-    private static final int iterations = 20*1000;\r
-    private static final int saltLen = 32;\r
-    private static final int desiredKeyLen = 256;\r
+       // The higher the number of iterations the more\r
+       // expensive computing the hash is for us and\r
+       // also for an attacker.\r
+       private static final int iterations = 20 * 1000;\r
+       private static final int saltLen = 32;\r
+       private static final int desiredKeyLen = 256;\r
 \r
 \r
-    /** Computes a salted PBKDF2 hash of given plaintext password\r
-        suitable for storing in a database. \r
-        Empty passwords are not supported. */\r
-    public static String getSaltedHash(String password) throws Exception {\r
-        byte[] salt = SecureRandom.getInstance("SHA1PRNG").generateSeed(saltLen);\r
-        // store the salt with the password\r
-        return Base64.encodeBase64String(salt) + "$" + hash(password, salt);\r
-    }\r
+       /**\r
+        * Computes a salted PBKDF2 hash of given plaintext password suitable for\r
+        * storing in a database. Empty passwords are not supported.\r
+        */\r
+       public static String getSaltedHash(String password) throws Exception {\r
+               byte[] salt = SecureRandom.getInstance("SHA1PRNG").generateSeed(saltLen);\r
+               // store the salt with the password\r
+               return Base64.encodeBase64String(salt) + "$" + hash(password, salt);\r
+       }\r
 \r
 \r
-    /** Checks whether given plaintext password corresponds \r
-        to a stored salted hash of the password. */\r
-    public static boolean check(String password, String stored) throws Exception{\r
-        String[] saltAndPass = stored.split("\\$");\r
-        if (saltAndPass.length != 2) {\r
-            throw new IllegalStateException(\r
-                "The stored password have the form 'salt$hash'");\r
-        }\r
-        String hashOfInput = hash(password, Base64.decodeBase64(saltAndPass[0]));\r
-        return hashOfInput.equals(saltAndPass[1]);\r
-    }\r
+       /**\r
+        * Checks whether given plaintext password corresponds to a stored salted\r
+        * hash of the password.\r
+        */\r
+       public static boolean check(String password, String stored) throws Exception {\r
+               String[] saltAndPass = stored.split("\\$");\r
+               if (saltAndPass.length != 2) {\r
+                       throw new IllegalStateException("The stored password have the form 'salt$hash'");\r
+               }\r
+               String hashOfInput = hash(password, Base64.decodeBase64(saltAndPass[0]));\r
+               return hashOfInput.equals(saltAndPass[1]);\r
+       }\r
 \r
 \r
-    // using PBKDF2 from Sun, an alternative is https://github.com/wg/scrypt\r
-    // cf. http://www.unlimitednovelty.com/2012/03/dont-use-bcrypt.html\r
-    private static String hash(String password, byte[] salt) throws Exception {\r
-        if (password == null || password.length() == 0)\r
-            throw new IllegalArgumentException("Empty passwords are not supported.");\r
-        SecretKeyFactory f = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");\r
-        SecretKey key = f.generateSecret(new PBEKeySpec(\r
-            password.toCharArray(), salt, iterations, desiredKeyLen)\r
-        );\r
-        return Base64.encodeBase64String(key.getEncoded());\r
-    }\r
+       // using PBKDF2 from Sun, an alternative is https://github.com/wg/scrypt\r
+       // cf. http://www.unlimitednovelty.com/2012/03/dont-use-bcrypt.html\r
+       private static String hash(String password, byte[] salt) throws Exception {\r
+               if (password == null || password.length() == 0)\r
+                       throw new IllegalArgumentException("Empty passwords are not supported.");\r
+               SecretKeyFactory f = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");\r
+               SecretKey key = f.generateSecret(new PBEKeySpec(password.toCharArray(), salt, iterations, desiredKeyLen));\r
+               return Base64.encodeBase64String(key.getEncoded());\r
+       }\r
 }\r
 }\r
index ff00e7c..27a13ea 100644 (file)
@@ -9,4 +9,4 @@ package ch.bfh.ti.srs.extern;
 \r
 /*\r
  * Imported or copied code from trusted sources, no need to test\r
 \r
 /*\r
  * Imported or copied code from trusted sources, no need to test\r
- */
\ No newline at end of file
+ */\r
index de19d9f..7bfc06a 100644 (file)
@@ -6,7 +6,3 @@
  * Distributable under GPL license. See terms of license at gnu.org.\r
  */\r
 package ch.bfh.ti.srs.gui;\r
  * Distributable under GPL license. See terms of license at gnu.org.\r
  */\r
 package ch.bfh.ti.srs.gui;\r
-\r
-/*\r
- * \r
- */
\ No newline at end of file
index 91c8082..c507ff5 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * Copyright (c) 2015 Berner Fachhochschule, Switzerland.
+ *
+ * Project Smart Reservation System.
+ *
+ * Distributable under GPL license. See terms of license at gnu.org.
+ */
 package ch.bfh.ti.srs.noTest;
 
 import java.sql.Connection;
 package ch.bfh.ti.srs.noTest;
 
 import java.sql.Connection;
@@ -20,7 +27,6 @@ import ch.bfh.ti.srs.dataschema.User;
  */
 /**
  * @author Michael
  */
 /**
  * @author Michael
- *
  */
 public class DataHandlerForExcel implements DataHandler {
        private String filePath;
  */
 public class DataHandlerForExcel implements DataHandler {
        private String filePath;
@@ -54,10 +60,10 @@ public class DataHandlerForExcel implements DataHandler {
        public boolean addUser(User user) throws Exception {
                if (findUser(user.getUserName()) != null)
                        throw new Exception("User already exists!");
        public boolean addUser(User user) throws Exception {
                if (findUser(user.getUserName()) != null)
                        throw new Exception("User already exists!");
-               else{
-               insertNewUser(user);
-               updateUserList();
-               return true;
+               else {
+                       insertNewUser(user);
+                       updateUserList();
+                       return true;
                }
        }
 
                }
        }
 
@@ -174,13 +180,13 @@ public class DataHandlerForExcel implements DataHandler {
        @Override
        public void saveChanges() {
                // TODO Auto-generated method stub
        @Override
        public void saveChanges() {
                // TODO Auto-generated method stub
-               
+
        }
 
        @Override
        public void refresh(boolean discardChanges) throws Exception {
                // TODO Auto-generated method stub
        }
 
        @Override
        public void refresh(boolean discardChanges) throws Exception {
                // TODO Auto-generated method stub
-               
+
        }
 
        @Override
        }
 
        @Override
index 2b125db..d1d1b6c 100644 (file)
@@ -9,4 +9,4 @@ package ch.bfh.ti.srs.noTest;
 \r
 /*\r
  * Package for classes that are currently not used and therefore not tested\r
 \r
 /*\r
  * Package for classes that are currently not used and therefore not tested\r
- */
\ No newline at end of file
+ */\r
index 3689ce6..0f9fed3 100644 (file)
@@ -67,14 +67,7 @@ Sprint Backlog
 |                      |                                                       |                                                       |                               |Effort |Effort |Effort |                       |
 |                      |                                                       |                                                       |                               |[h]    |[h]    |[h]    |                       |
 *-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
 |                      |                                                       |                                                       |                               |Effort |Effort |Effort |                       |
 |                      |                                                       |                                                       |                               |[h]    |[h]    |[h]    |                       |
 *-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
-| 5                    | -     Reservations                    | erlaubt es dem Benutzer       |High                   |3              |               |               |in progress|
-|                      |       bearbeiten                              | seine Reservation             |                               |               |               |               |                       |
-|                      |                                                       | anzupassen                            |                               |               |               |               |                       |
-*-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
-| 5.1          |                                                       | Methode im UserController     |High                   |3              |               |               |in progress|
-|                      |                                                       | erstellen                                     |                               |               |               |               |                       |
-|                      |                                                       |                                                       |                               |               |               |               |                       |
-*-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
+
 
 
 * 3. finished tasks
 
 
 * 3. finished tasks
@@ -106,7 +99,7 @@ Sprint Backlog
 | 1.6          |                                                       | Tests für Daten                      |High                   |2              |               |2              |Done           |
 |                      |                                                       | handling                                      |                               |               |               |               |                       |
 *-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
 | 1.6          |                                                       | Tests für Daten                      |High                   |2              |               |2              |Done           |
 |                      |                                                       | handling                                      |                               |               |               |               |                       |
 *-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
-| 3                    | - Ressourcen Reservieren      | erlaubt es einem User         |High                   |12             |               |               |Done           |
+| 3                    | - Ressourcen Reservieren      | erlaubt es einem User         |High                   |13             |               |16             |Done           |
 |                      |                                                       | eine neue Reservation         |                               |               |               |               |                       |
 |                      |                                                       | zu tätigen                           |                               |               |               |               |                       |
 *-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
 |                      |                                                       | eine neue Reservation         |                               |               |               |               |                       |
 |                      |                                                       | zu tätigen                           |                               |               |               |               |                       |
 *-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
@@ -125,7 +118,7 @@ Sprint Backlog
 | 3.5          |                                                       | DataHandler Erweitern         |High                   |3              |               |4              |Done           |
 |                      |                                                       |                                                       |                               |               |               |               |                       |
 *-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
 | 3.5          |                                                       | DataHandler Erweitern         |High                   |3              |               |4              |Done           |
 |                      |                                                       |                                                       |                               |               |               |               |                       |
 *-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
-| 4                    | - Resourcen belegung          | Der User kann prüfen         |High                   |2              |               |               |Done           |
+| 4                    | - Resourcen belegung          | Der User kann prüfen         |High                   |2              |               |3              |Done           |
 |                      |       prüfen                                 | ob eine Resource schon        |                               |               |               |               |                       |
 |                      |                                                       | reserviert ist                        |                               |               |               |               |                       |
 *-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
 |                      |       prüfen                                 | ob eine Resource schon        |                               |               |               |               |                       |
 |                      |                                                       | reserviert ist                        |                               |               |               |               |                       |
 *-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
@@ -136,7 +129,15 @@ Sprint Backlog
 | 4.2          |                                                       | Test für 4.1                         |High                   |1              |               |1              |Done           |
 |                      |                                                       |                                                       |                               |               |               |               |                       |
 *-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
 | 4.2          |                                                       | Test für 4.1                         |High                   |1              |               |1              |Done           |
 |                      |                                                       |                                                       |                               |               |               |               |                       |
 *-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
-| 6                    | -     Reservations                    | erlaubt es dem User           |High                   |3              |               |               |Done           |
+| 5                    | -     Reservations                    | erlaubt es dem Benutzer       |High                   |3              |               |3              |Done           |
+|                      |       bearbeiten                              | seine Reservation             |                               |               |               |               |                       |
+|                      |                                                       | anzupassen                            |                               |               |               |               |                       |
+*-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
+| 5.1          |                                                       | Methode im UserController     |High                   |3              |               |3              |Done           |
+|                      |                                                       | erstellen                                     |                               |               |               |               |                       |
+|                      |                                                       |                                                       |                               |               |               |               |                       |
+*-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
+| 6                    | -     Reservations                    | erlaubt es dem User           |High                   |3              |               |5              |Done           |
 |                      |       wiederholungen                  | z.B wöchentliche             |                               |               |               |               |                       |
 |                      |                                                       | reservationen zu machen       |                               |               |               |               |                       |
 *-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
 |                      |       wiederholungen                  | z.B wöchentliche             |                               |               |               |               |                       |
 |                      |                                                       | reservationen zu machen       |                               |               |               |               |                       |
 *-----------+---------------------------+---------------------------+---------------+-------+-------+-------+-----------+
index c8cf6a9..5b06f2a 100644 (file)
@@ -38,163 +38,162 @@ import ch.bfh.ti.srs.dataschema.User;
 public class UserControllerTest {\r
 \r
        @Test\r
 public class UserControllerTest {\r
 \r
        @Test\r
-       public void addUserTest() throws Exception{\r
+       public void addUserTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \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.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
-       \r
-       @Test(expected=Exception.class)\r
-       public void addUserExceptionTest() throws Exception{\r
+\r
+       @Test(expected = Exception.class)\r
+       public void addUserExceptionTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \r
+\r
                uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
        }\r
 \r
        @Test\r
                uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
        }\r
 \r
        @Test\r
-       public void logInTest() throws Exception{\r
+       public void logInTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \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
                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
+\r
                uc.logIn("TestUser3", "pass3");\r
        }\r
                uc.logIn("TestUser3", "pass3");\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void logInException1Test() throws Exception{\r
+\r
+       @Test(expected = Exception.class)\r
+       public void logInException1Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                uc.logIn("TestUser3", "pass3");\r
        }\r
 \r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                uc.logIn("TestUser3", "pass3");\r
        }\r
 \r
-       @Test(expected=Exception.class)\r
-       public void logInException2Test() throws Exception{\r
+       @Test(expected = Exception.class)\r
+       public void logInException2Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \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.setDataHandler(dh);\r
                uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
-               \r
+\r
                uc.logIn("TestUser1", "pass1");\r
                uc.logIn("TestUser2", "pass2");\r
        }\r
                uc.logIn("TestUser1", "pass1");\r
                uc.logIn("TestUser2", "pass2");\r
        }\r
-       \r
+\r
        @Test\r
        @Test\r
-       public void logInInvalidCredetialsTest() throws Exception{\r
+       public void logInInvalidCredetialsTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \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.setDataHandler(dh);\r
                uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                uc.addUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
-               \r
+\r
                assertFalse(uc.logIn("TestUser3", "pass3"));\r
                assertFalse(uc.logIn("TestUser1", "pass2"));\r
                assertTrue(uc.logIn("TestUser1", "pass1"));\r
        }\r
                assertFalse(uc.logIn("TestUser3", "pass3"));\r
                assertFalse(uc.logIn("TestUser1", "pass2"));\r
                assertTrue(uc.logIn("TestUser1", "pass1"));\r
        }\r
-       \r
+\r
        @Test\r
        @Test\r
-       public void getLoggedUserNameTest() throws Exception{\r
+       public void getLoggedUserNameTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \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
                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
+\r
                uc.logIn("TestUser1", "pass1");\r
                assertEquals("TestUser1", uc.getLoggedUserName());\r
        }\r
                uc.logIn("TestUser1", "pass1");\r
                assertEquals("TestUser1", uc.getLoggedUserName());\r
        }\r
-       \r
 \r
 \r
-       @Test(expected=Exception.class)\r
-       public void getLoggedUserNameExceptionTest() throws Exception{\r
+       @Test(expected = Exception.class)\r
+       public void getLoggedUserNameExceptionTest() throws Exception {\r
                UserController uc = new UserController();\r
                String currentUserName = uc.getLoggedUserName();\r
        }\r
                UserController uc = new UserController();\r
                String currentUserName = uc.getLoggedUserName();\r
        }\r
-       \r
+\r
        @Test\r
        @Test\r
-       public void getLoggedUserMailTest() throws Exception{\r
+       public void getLoggedUserMailTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \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
                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
+\r
                uc.logIn("TestUser2", "pass2");\r
                assertEquals("hanfli@bfh.ch", uc.getLoggedMail());\r
        }\r
                uc.logIn("TestUser2", "pass2");\r
                assertEquals("hanfli@bfh.ch", uc.getLoggedMail());\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void getLoggedMailExceptionTest() throws Exception{\r
+\r
+       @Test(expected = Exception.class)\r
+       public void getLoggedMailExceptionTest() throws Exception {\r
                UserController uc = new UserController();\r
                String currentMail = uc.getLoggedMail();\r
        }\r
                UserController uc = new UserController();\r
                String currentMail = uc.getLoggedMail();\r
        }\r
-       \r
+\r
        @Test\r
        @Test\r
-       public void getLoggedNameTest() throws Exception{\r
+       public void getLoggedNameTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \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
                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
+\r
                uc.logIn("TestUser3", "pass3");\r
                assertEquals("Hanfli", uc.getLoggedName());\r
        }\r
                uc.logIn("TestUser3", "pass3");\r
                assertEquals("Hanfli", uc.getLoggedName());\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void getLoggedNameExceptionTest() throws Exception{\r
+\r
+       @Test(expected = Exception.class)\r
+       public void getLoggedNameExceptionTest() throws Exception {\r
                UserController uc = new UserController();\r
                uc.getLoggedName();\r
        }\r
                UserController uc = new UserController();\r
                uc.getLoggedName();\r
        }\r
-       \r
+\r
        @Test\r
        @Test\r
-       public void getLoggedLastnameTest() throws Exception{\r
+       public void getLoggedLastnameTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \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
                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
+\r
                uc.logIn("TestUser4", "pass4");\r
                assertEquals("User", uc.getLoggedLastname());\r
        }\r
                uc.logIn("TestUser4", "pass4");\r
                assertEquals("User", uc.getLoggedLastname());\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void getLoggedLastnameExceptionTest() throws Exception{\r
+\r
+       @Test(expected = Exception.class)\r
+       public void getLoggedLastnameExceptionTest() throws Exception {\r
                UserController uc = new UserController();\r
                String currentLastName = uc.getLoggedLastname();\r
        }\r
                UserController uc = new UserController();\r
                String currentLastName = uc.getLoggedLastname();\r
        }\r
-       \r
+\r
        @Test\r
        @Test\r
-       public void getLoggedUserTest() throws Exception{\r
+       public void getLoggedUserTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \r
+\r
                uc.setDataHandler(dh);\r
                uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                assertEquals(null, uc.getLoggedUser());\r
                uc.setDataHandler(dh);\r
                uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                assertEquals(null, uc.getLoggedUser());\r
@@ -202,724 +201,736 @@ public class UserControllerTest {
                assertEquals("TestUser1", uc.getLoggedUser().getUserName());\r
        }\r
 \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();\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
+       // @Test(expected=Exception.class)\r
+       // public void getLoggedUserExceptionTest() throws Exception{\r
+       // DataHandler dh = new DataHandlerForTests();\r
+       // UserController uc = new UserController();\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
        @Test\r
        @Test\r
-       public void getUserTest() throws Exception{\r
+       public void getUserTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \r
+\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
        }\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
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void getUserExceptionTest() throws Exception{\r
+\r
+       @Test(expected = Exception.class)\r
+       public void getUserExceptionTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \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
                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
+\r
        @Test\r
        @Test\r
-       public void logOutTest() throws Exception{\r
+       public void logOutTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \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
                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
+\r
                uc.logIn("TestUser1", "pass1");\r
                assertEquals("TestUser1", uc.getLoggedUserName());\r
                uc.logOut();\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
+\r
+       @Test(expected = Exception.class)\r
+       public void logOutException1Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \r
+\r
                uc.logOut();\r
        }\r
                uc.logOut();\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void logOutException2Test() throws Exception{\r
+\r
+       @Test(expected = Exception.class)\r
+       public void logOutException2Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
-               \r
+\r
                uc.setDataHandler(dh);\r
                uc.logOut();\r
        }\r
                uc.setDataHandler(dh);\r
                uc.logOut();\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void getUserExpectionTest() throws Exception{\r
+\r
+       @Test(expected = Exception.class)\r
+       public void getUserExpectionTest() throws Exception {\r
                UserController uc = new UserController();\r
                uc.getUser(null);\r
        }\r
                UserController uc = new UserController();\r
                uc.getUser(null);\r
        }\r
-       \r
+\r
        @Test\r
        @Test\r
-       public void getReservationTests() throws Exception{\r
+       public void getReservationTests() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                UUID groupId = UUID.randomUUID();\r
                UUID groupId = UUID.randomUUID();\r
-               Date start = new Date(2015,11,28,11,00,00);\r
-               Date finish = new Date(2015,11,28,11,30,00);\r
+               Date start = new Date(2015, 11, 28, 11, 00, 00);\r
+               Date finish = new Date(2015, 11, 28, 11, 30, 00);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
-               \r
+\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
-               \r
-               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange, "Test reservation1");\r
-               Reservation reservation2 = new Reservation(groupId, uc.getLoggedUser(), resource2, dateRange, "Test reservation2");\r
+\r
+               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
+                               "Test reservation1");\r
+               Reservation reservation2 = new Reservation(groupId, uc.getLoggedUser(), resource2, dateRange,\r
+                               "Test reservation2");\r
                Reservation reservation3 = new Reservation(groupId, testUser2, resource3, dateRange, "Test reservation3");\r
                dh.addReservation(reservation1);\r
                dh.addReservation(reservation2);\r
                dh.addReservation(reservation3);\r
                Reservation reservation3 = new Reservation(groupId, testUser2, resource3, dateRange, "Test reservation3");\r
                dh.addReservation(reservation1);\r
                dh.addReservation(reservation2);\r
                dh.addReservation(reservation3);\r
-               \r
+\r
                Map<Reservation, Boolean> loggedUserReservation = uc.getUserReservations(null);\r
                Map<Reservation, Boolean> reservationMap = uc.getUserReservations(testUser2);\r
                Map<Reservation, Boolean> reservationDateRangeMap = uc.getReservationsInDateRange(dateRange);\r
                Map<Reservation, Boolean> reservationGroupMap = uc.getReservationGroup(groupId);\r
                Map<Reservation, Boolean> loggedUserReservation = uc.getUserReservations(null);\r
                Map<Reservation, Boolean> reservationMap = uc.getUserReservations(testUser2);\r
                Map<Reservation, Boolean> reservationDateRangeMap = uc.getReservationsInDateRange(dateRange);\r
                Map<Reservation, Boolean> reservationGroupMap = uc.getReservationGroup(groupId);\r
-               \r
+\r
                assertEquals(reservationDateRangeMap, reservationGroupMap);\r
                assertEquals(reservationDateRangeMap, reservationGroupMap);\r
-               \r
+\r
                assertTrue(loggedUserReservation.containsKey(reservation1));\r
                assertTrue(loggedUserReservation.containsKey(reservation2));\r
                assertFalse(loggedUserReservation.containsKey(reservation3));\r
                assertTrue(reservationMap.containsKey(reservation3));\r
                assertTrue(loggedUserReservation.containsKey(reservation1));\r
                assertTrue(loggedUserReservation.containsKey(reservation2));\r
                assertFalse(loggedUserReservation.containsKey(reservation3));\r
                assertTrue(reservationMap.containsKey(reservation3));\r
-               \r
+\r
                for (Map.Entry<Reservation, Boolean> entry : reservationDateRangeMap.entrySet()) {\r
                for (Map.Entry<Reservation, Boolean> entry : reservationDateRangeMap.entrySet()) {\r
-                       if(entry.getKey().getUser().getUserName().equals("TestUser1")){\r
+                       if (entry.getKey().getUser().getUserName().equals("TestUser1")) {\r
                                assertTrue(entry.getValue());\r
                                assertEquals(entry.getKey().getId(), uc.getReservation(entry.getKey().getId()).getId());\r
                                assertTrue(entry.getValue());\r
                                assertEquals(entry.getKey().getId(), uc.getReservation(entry.getKey().getId()).getId());\r
-                       }\r
-                       else{\r
+                       } else {\r
                                assertFalse(entry.getValue());\r
                                assertEquals(entry.getKey().getId(), uc.getReservation(entry.getKey().getId()).getId());\r
                        }\r
                }\r
                assertEquals(null, uc.getReservation(UUID.randomUUID()));\r
        }\r
                                assertFalse(entry.getValue());\r
                                assertEquals(entry.getKey().getId(), uc.getReservation(entry.getKey().getId()).getId());\r
                        }\r
                }\r
                assertEquals(null, uc.getReservation(UUID.randomUUID()));\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void getReservationGroupException1Test() throws Exception{\r
+\r
+       @Test(expected = Exception.class)\r
+       public void getReservationGroupException1Test() throws Exception {\r
                UserController uc = new UserController();\r
                uc.getReservationGroup(null);\r
        }\r
                UserController uc = new UserController();\r
                uc.getReservationGroup(null);\r
        }\r
-       \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void getReservationGroupException2Test() throws Exception{\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
                uc.getReservationGroup(null);\r
        }\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                uc.setDataHandler(dh);\r
                uc.getReservationGroup(null);\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void getUserReservationException1Test() throws Exception{\r
+\r
+       @Test(expected = Exception.class)\r
+       public void getUserReservationException1Test() throws Exception {\r
                UserController uc = new UserController();\r
                uc.getUserReservations(null);\r
        }\r
                UserController uc = new UserController();\r
                uc.getUserReservations(null);\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void getUserReservationException2Test() throws Exception{\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
                uc.getUserReservations(null);\r
        }\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                uc.setDataHandler(dh);\r
                uc.getUserReservations(null);\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void getReservationException1Test() throws Exception{\r
+\r
+       @Test(expected = Exception.class)\r
+       public void getReservationException1Test() throws Exception {\r
                UserController uc = new UserController();\r
                uc.getReservation(null);\r
        }\r
                UserController uc = new UserController();\r
                uc.getReservation(null);\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void getReservationException2Test() throws Exception{\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
                uc.getReservation(null);\r
        }\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                uc.setDataHandler(dh);\r
                uc.getReservation(null);\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void getReservationsInDateRangeException1Test() throws Exception{\r
+\r
+       @Test(expected = Exception.class)\r
+       public void getReservationsInDateRangeException1Test() throws Exception {\r
                UserController uc = new UserController();\r
                uc.getReservationsInDateRange(null);\r
        }\r
                UserController uc = new UserController();\r
                uc.getReservationsInDateRange(null);\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void getReservationsInDateRangeException2Test() throws Exception{\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
                uc.getReservationsInDateRange(null);\r
        }\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\r
                uc.setDataHandler(dh);\r
                uc.getReservationsInDateRange(null);\r
        }\r
-       \r
+\r
        @Test\r
        @Test\r
-       public void makeReservationTest() throws Exception{\r
+       public void makeReservationTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
-               \r
+\r
                List<DateRange> dtList = new ArrayList<DateRange>();\r
                List<DateRange> dtList = new ArrayList<DateRange>();\r
-               for(int i = 1;i<10;i++){\r
-                       dtList.add(new DateRangeImpl(new Date(2015,12,2+i,11,00,00), new Date(2015,12,2+i,11,00,00)));\r
+               for (int i = 1; i < 10; i++) {\r
+                       dtList.add(new DateRangeImpl(new Date(2015, 12, 2 + i, 11, 00, 00), new Date(2015, 12, 2 + i, 11, 00, 00)));\r
                }\r
                }\r
-               \r
+\r
                assertEquals(null, uc.makeReservation(uc.getLoggedUser(), resource1, dtList, "remark"));\r
                assertEquals(null, uc.makeReservation(null, resource2, dtList, "remark"));\r
        }\r
                assertEquals(null, uc.makeReservation(uc.getLoggedUser(), resource1, dtList, "remark"));\r
                assertEquals(null, uc.makeReservation(null, resource2, dtList, "remark"));\r
        }\r
-       \r
+\r
        @Test\r
        @Test\r
-       public void makeInvalidReservationTest() throws Exception{\r
+       public void makeInvalidReservationTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
-               \r
+\r
                List<DateRange> dtList = new ArrayList<DateRange>();\r
                List<DateRange> dtList = new ArrayList<DateRange>();\r
-               for(int i = 1;i<10;i++){\r
-                       dtList.add(new DateRangeImpl(new Date(2015,12,2+i,11,00,00), new Date(2015,12,2+i,12,00,00)));\r
+               for (int i = 1; i < 10; i++) {\r
+                       dtList.add(new DateRangeImpl(new Date(2015, 12, 2 + i, 11, 00, 00), new Date(2015, 12, 2 + i, 12, 00, 00)));\r
                }\r
                }\r
-               \r
+\r
                List<DateRange> conflictingList = new ArrayList<DateRange>();\r
                // Conflicts\r
                List<DateRange> conflictingList = new ArrayList<DateRange>();\r
                // Conflicts\r
-               conflictingList.add(new DateRangeImpl(new Date(2015,12,4,11,00,00),new Date(2015,12,4,12,00,00)));\r
-               conflictingList.add(new DateRangeImpl(new Date(2015,12,4,11,15,00),new Date(2015,12,4,11,45,00)));\r
-               conflictingList.add(new DateRangeImpl(new Date(2015,12,4,10,00,00),new Date(2015,12,4,17,00,00)));\r
-               conflictingList.add(new DateRangeImpl(new Date(2015,12,4,11,30,00),new Date(2015,12,4,12,30,00)));\r
-               \r
+               conflictingList.add(new DateRangeImpl(new Date(2015, 12, 4, 11, 00, 00), new Date(2015, 12, 4, 12, 00, 00)));\r
+               conflictingList.add(new DateRangeImpl(new Date(2015, 12, 4, 11, 15, 00), new Date(2015, 12, 4, 11, 45, 00)));\r
+               conflictingList.add(new DateRangeImpl(new Date(2015, 12, 4, 10, 00, 00), new Date(2015, 12, 4, 17, 00, 00)));\r
+               conflictingList.add(new DateRangeImpl(new Date(2015, 12, 4, 11, 30, 00), new Date(2015, 12, 4, 12, 30, 00)));\r
+\r
                // OK\r
                // OK\r
-               conflictingList.add(new DateRangeImpl(new Date(2015,12,4,10,30,00),new Date(2015,12,4,10,59,59)));\r
-               conflictingList.add(new DateRangeImpl(new Date(2015,12,4,12,00,01),new Date(2015,12,4,12,45,00)));\r
+               conflictingList.add(new DateRangeImpl(new Date(2015, 12, 4, 10, 30, 00), new Date(2015, 12, 4, 10, 59, 59)));\r
+               conflictingList.add(new DateRangeImpl(new Date(2015, 12, 4, 12, 00, 01), new Date(2015, 12, 4, 12, 45, 00)));\r
 \r
 \r
-               assertEquals(null, uc.makeReservation(uc.getLoggedUser(), resource1, dtList, "remark"));                \r
+               assertEquals(null, uc.makeReservation(uc.getLoggedUser(), resource1, dtList, "remark"));\r
                assertEquals(4, uc.makeReservation(uc.getLoggedUser(), resource1, conflictingList, null).size());\r
        }\r
 \r
                assertEquals(4, uc.makeReservation(uc.getLoggedUser(), resource1, conflictingList, null).size());\r
        }\r
 \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void makeReservationException1Test() throws Exception{\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
                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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
-               \r
+\r
                List<DateRange> dtList = new ArrayList<DateRange>();\r
                List<DateRange> dtList = new ArrayList<DateRange>();\r
-               for(int i = 1;i<10;i++){\r
-                       dtList.add(new DateRangeImpl(new Date(2015,12,2+i,11,00,00), new Date(2015,12,2+i,12,00,00)));\r
+               for (int i = 1; i < 10; i++) {\r
+                       dtList.add(new DateRangeImpl(new Date(2015, 12, 2 + i, 11, 00, 00), new Date(2015, 12, 2 + i, 12, 00, 00)));\r
                }\r
                }\r
-               \r
+\r
                uc.logOut();\r
                assertEquals(null, uc.makeReservation(null, resource1, dtList, "remark"));\r
        }\r
 \r
                uc.logOut();\r
                assertEquals(null, uc.makeReservation(null, resource1, dtList, "remark"));\r
        }\r
 \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void makeReservationException2Test() throws Exception{\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
                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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
-               \r
+\r
                List<DateRange> dtList = new ArrayList<DateRange>();\r
                List<DateRange> dtList = new ArrayList<DateRange>();\r
-               for(int i = 1;i<10;i++){\r
-                       dtList.add(new DateRangeImpl(new Date(2015,12,2+i,11,00,00), new Date(2015,12,2+i,12,00,00)));\r
+               for (int i = 1; i < 10; i++) {\r
+                       dtList.add(new DateRangeImpl(new Date(2015, 12, 2 + i, 11, 00, 00), new Date(2015, 12, 2 + i, 12, 00, 00)));\r
                }\r
                }\r
-               \r
+\r
                assertEquals(null, uc.makeReservation(null, null, dtList, "remark"));\r
        }\r
 \r
                assertEquals(null, uc.makeReservation(null, null, dtList, "remark"));\r
        }\r
 \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void makeReservationException3Test() throws Exception{\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
                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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
-               \r
+\r
                List<DateRange> dtList = new ArrayList<DateRange>();\r
                List<DateRange> dtList = new ArrayList<DateRange>();\r
-               for(int i = 1;i<10;i++){\r
-                       dtList.add(new DateRangeImpl(new Date(2015,12,2+i,11,00,00), new Date(2015,12,2+i,12,00,00)));\r
+               for (int i = 1; i < 10; i++) {\r
+                       dtList.add(new DateRangeImpl(new Date(2015, 12, 2 + i, 11, 00, 00), new Date(2015, 12, 2 + i, 12, 00, 00)));\r
                }\r
                }\r
-               \r
+\r
                assertEquals(null, uc.makeReservation(null, resource1, null, "remark"));\r
        }\r
 \r
                assertEquals(null, uc.makeReservation(null, resource1, null, "remark"));\r
        }\r
 \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void makeReservationException4Test() throws Exception{\r
+       @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
                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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
-               \r
+\r
                List<DateRange> dtList = new ArrayList<DateRange>();\r
                List<DateRange> dtList = new ArrayList<DateRange>();\r
-               \r
+\r
                assertEquals(null, uc.makeReservation(null, resource1, dtList, "remark"));\r
        }\r
                assertEquals(null, uc.makeReservation(null, resource1, dtList, "remark"));\r
        }\r
-       \r
+\r
        @Test\r
        @Test\r
-       public void changeReservationTest() throws Exception{\r
+       public void changeReservationTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                UUID groupId = UUID.randomUUID();\r
                UUID groupId = UUID.randomUUID();\r
-               DateRange dateRange = new DateRangeImpl(new Date(2015,12,7,14,00,00), new Date(2015,12,7,15,00,00));\r
-               \r
+               DateRange dateRange = new DateRangeImpl(new Date(2015, 12, 7, 14, 00, 00), new Date(2015, 12, 7, 15, 00, 00));\r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
-               \r
+\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
-               \r
-               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange, "Test reservation1");\r
+\r
+               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
+                               "Test reservation1");\r
                dh.addReservation(reservation1);\r
                dh.addReservation(reservation1);\r
-               \r
+\r
                Reservation reservationClone = uc.getReservation(reservation1.getId());\r
                Reservation reservationClone = uc.getReservation(reservation1.getId());\r
-               DateRange newDateRange = new DateRangeImpl(new Date(2015,12,7,20,00,00), new Date(2015,12,8,02,00,00));\r
+               DateRange newDateRange = new DateRangeImpl(new Date(2015, 12, 7, 20, 00, 00),\r
+                               new Date(2015, 12, 8, 02, 00, 00));\r
                reservationClone.setDateRange(newDateRange);\r
                uc.changeReservation(reservationClone);\r
                reservationClone.setDateRange(newDateRange);\r
                uc.changeReservation(reservationClone);\r
-               \r
+\r
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void changeReservationException1Test() throws Exception{\r
+\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
                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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
-               Date finish = (Date)start.clone();\r
+               Date finish = (Date) start.clone();\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
-               \r
+\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
-               \r
-               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange, "Test reservation1");\r
+\r
+               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
+                               "Test reservation1");\r
                dh.addReservation(reservation1);\r
                dh.addReservation(reservation1);\r
-               \r
+\r
                Reservation reservationClone = uc.getReservation(reservation1.getId());\r
                start.setDate(start.getDate() + 1);\r
                finish.setDate(finish.getDate() + 1);\r
                DateRange newDateRange = new DateRangeImpl(start, finish);\r
                reservationClone.setDateRange(newDateRange);\r
                Reservation reservationClone = uc.getReservation(reservation1.getId());\r
                start.setDate(start.getDate() + 1);\r
                finish.setDate(finish.getDate() + 1);\r
                DateRange newDateRange = new DateRangeImpl(start, finish);\r
                reservationClone.setDateRange(newDateRange);\r
-               \r
+\r
                uc.setDataHandler(null);\r
                uc.changeReservation(reservationClone);\r
                uc.setDataHandler(null);\r
                uc.changeReservation(reservationClone);\r
-               \r
+\r
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void changeReservationException2Test() throws Exception{\r
+\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
                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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
-               Date finish = (Date)start.clone();\r
+               Date finish = (Date) start.clone();\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
-               \r
+\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
-               \r
-               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange, "Test reservation1");\r
+\r
+               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
+                               "Test reservation1");\r
                dh.addReservation(reservation1);\r
                dh.addReservation(reservation1);\r
-               \r
+\r
                Reservation reservationClone = uc.getReservation(reservation1.getId());\r
                start.setDate(start.getDate() + 1);\r
                finish.setDate(finish.getDate() + 1);\r
                DateRange newDateRange = new DateRangeImpl(start, finish);\r
                reservationClone.setDateRange(newDateRange);\r
                Reservation reservationClone = uc.getReservation(reservation1.getId());\r
                start.setDate(start.getDate() + 1);\r
                finish.setDate(finish.getDate() + 1);\r
                DateRange newDateRange = new DateRangeImpl(start, finish);\r
                reservationClone.setDateRange(newDateRange);\r
-               \r
+\r
                uc.logOut();\r
                uc.changeReservation(reservationClone);\r
                uc.logOut();\r
                uc.changeReservation(reservationClone);\r
-               \r
+\r
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
-       \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void changeReservationException3Test() throws Exception{\r
+\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
                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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
-               Date finish = (Date)start.clone();\r
+               Date finish = (Date) start.clone();\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
-               \r
+\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
-               \r
-               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange, "Test reservation1");\r
+\r
+               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
+                               "Test reservation1");\r
                dh.addReservation(reservation1);\r
                dh.addReservation(reservation1);\r
-               \r
+\r
                Reservation reservationClone = uc.getReservation(reservation1.getId());\r
                start.setDate(start.getDate() + 1);\r
                finish.setDate(finish.getDate() + 1);\r
                DateRange newDateRange = new DateRangeImpl(start, finish);\r
                reservationClone.setDateRange(newDateRange);\r
                Reservation reservationClone = uc.getReservation(reservation1.getId());\r
                start.setDate(start.getDate() + 1);\r
                finish.setDate(finish.getDate() + 1);\r
                DateRange newDateRange = new DateRangeImpl(start, finish);\r
                reservationClone.setDateRange(newDateRange);\r
-               \r
+\r
                uc.changeReservation(null);\r
                uc.changeReservation(null);\r
-               \r
+\r
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void changeReservationException4Test() throws Exception{\r
+\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
                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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
-               Date finish = (Date)start.clone();\r
+               Date finish = (Date) start.clone();\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
-               \r
+\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
-               \r
-               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange, "Test reservation1");\r
+\r
+               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
+                               "Test reservation1");\r
                dh.addReservation(reservation1);\r
                dh.addReservation(reservation1);\r
-               \r
+\r
                Reservation reservationClone = uc.getReservation(reservation1.getId());\r
                start.setDate(start.getDate() + 1);\r
                finish.setDate(finish.getDate() + 1);\r
                DateRange newDateRange = new DateRangeImpl(start, finish);\r
                reservationClone.setDateRange(newDateRange);\r
                Reservation reservationClone = uc.getReservation(reservation1.getId());\r
                start.setDate(start.getDate() + 1);\r
                finish.setDate(finish.getDate() + 1);\r
                DateRange newDateRange = new DateRangeImpl(start, finish);\r
                reservationClone.setDateRange(newDateRange);\r
-               \r
+\r
                uc.logOut();\r
                uc.logIn("TestUser2", "pass2");\r
                uc.changeReservation(reservationClone);\r
                uc.logOut();\r
                uc.logIn("TestUser2", "pass2");\r
                uc.changeReservation(reservationClone);\r
-               \r
+\r
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
                assertEquals(newDateRange, uc.getReservation(reservationClone.getId()).getDateRange());\r
        }\r
-       \r
+\r
        @Test\r
        @Test\r
-       public void deleteReservationTest() throws Exception{\r
+       public void deleteReservationTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
-               Date finish = (Date)start.clone();\r
+               Date finish = (Date) start.clone();\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
-               \r
+\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
-               \r
-               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange, "Test reservation1");\r
+\r
+               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
+                               "Test reservation1");\r
                dh.addReservation(reservation1);\r
                dh.addReservation(reservation1);\r
-               \r
+\r
                uc.deleteReservation(reservation1);\r
                uc.deleteReservation(reservation1);\r
-               \r
+\r
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void deleteReservationException1Test() throws Exception{\r
+\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
                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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
-               Date finish = (Date)start.clone();\r
+               Date finish = (Date) start.clone();\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
-               \r
+\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
-               \r
-               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange, "Test reservation1");\r
+\r
+               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
+                               "Test reservation1");\r
                dh.addReservation(reservation1);\r
                dh.addReservation(reservation1);\r
-               \r
+\r
                uc.setDataHandler(null);\r
                uc.deleteReservation(reservation1);\r
                uc.setDataHandler(null);\r
                uc.deleteReservation(reservation1);\r
-               \r
+\r
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void deleteReservationException2Test() throws Exception{\r
+\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
                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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
-               Date finish = (Date)start.clone();\r
+               Date finish = (Date) start.clone();\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
-               \r
+\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
-               \r
-               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange, "Test reservation1");\r
+\r
+               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
+                               "Test reservation1");\r
                dh.addReservation(reservation1);\r
                dh.addReservation(reservation1);\r
-               \r
+\r
                uc.logOut();\r
                uc.deleteReservation(reservation1);\r
                uc.logOut();\r
                uc.deleteReservation(reservation1);\r
-               \r
+\r
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
-       \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void deleteReservationException3Test() throws Exception{\r
+\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
                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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
-               Date finish = (Date)start.clone();\r
+               Date finish = (Date) start.clone();\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
-               \r
+\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
-               \r
-               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange, "Test reservation1");\r
+\r
+               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
+                               "Test reservation1");\r
                dh.addReservation(reservation1);\r
                dh.addReservation(reservation1);\r
-               \r
+\r
                uc.deleteReservation(null);\r
                uc.deleteReservation(null);\r
-               \r
+\r
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void deleteReservationException4Test() throws Exception{\r
+\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
                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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
                UUID groupId = UUID.randomUUID();\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
-               Date finish = (Date)start.clone();\r
+               Date finish = (Date) start.clone();\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
                finish.setMinutes(start.getMinutes() + 30);\r
                DateRange dateRange = new DateRangeImpl(start, finish);\r
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
-               \r
+\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
                User loggedUser = uc.getLoggedUser();\r
                User testUser2 = uc.getUser("TestUser2");\r
-               \r
-               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange, "Test reservation1");\r
+\r
+               Reservation reservation1 = new Reservation(groupId, uc.getLoggedUser(), resource1, dateRange,\r
+                               "Test reservation1");\r
                dh.addReservation(reservation1);\r
                dh.addReservation(reservation1);\r
-               \r
+\r
                uc.logOut();\r
                uc.logIn("TestUser2", "pass2");\r
                uc.deleteReservation(reservation1);\r
                uc.logOut();\r
                uc.logIn("TestUser2", "pass2");\r
                uc.deleteReservation(reservation1);\r
-               \r
+\r
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
                assertEquals(null, uc.getReservation(reservation1.getId()));\r
        }\r
-       \r
+\r
        @Test\r
        @Test\r
-       public void getResourcesTest() throws Exception{\r
+       public void getResourcesTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
-               Date finish = (Date)start.clone();\r
+               Date finish = (Date) start.clone();\r
                finish.setMinutes(start.getMinutes() + 30);\r
                finish.setMinutes(start.getMinutes() + 30);\r
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
-               \r
+\r
                List<Resource> resList = uc.getResources();\r
                List<Resource> resList = uc.getResources();\r
-               \r
-               assertEquals(3,resList.size());\r
+\r
+               assertEquals(3, resList.size());\r
        }\r
        }\r
-       \r
-       @Test(expected=Exception.class)\r
-       public void getResourcesExceptionTest() throws Exception{\r
+\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
                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
                DataHandler dh = new DataHandlerForTests();\r
                UserController uc = new UserController();\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
-               \r
+\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
                Date start = new Date();\r
                start.setTime((System.currentTimeMillis() % 1000));\r
-               Date finish = (Date)start.clone();\r
+               Date finish = (Date) start.clone();\r
                finish.setMinutes(start.getMinutes() + 30);\r
                finish.setMinutes(start.getMinutes() + 30);\r
-               \r
+\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
                Resource resource1 = new Resource("Room101", "Class room");\r
                Resource resource2 = new Resource("Room101", "Class room");\r
                Resource resource3 = new Resource("Room101", "Class room");\r
                dh.addResource(resource1);\r
                dh.addResource(resource2);\r
                dh.addResource(resource3);\r
-               \r
+\r
                uc.setDataHandler(null);\r
                List<Resource> resList = uc.getResources();\r
                uc.setDataHandler(null);\r
                List<Resource> resList = uc.getResources();\r
-               \r
-               assertEquals(3,resList.size());\r
+\r
+               assertEquals(3, resList.size());\r
        }\r
 }\r
        }\r
 }\r
index 94ff551..bb3737c 100644 (file)
@@ -29,11 +29,11 @@ import ch.bfh.ti.srs.dataschema.User;
 /**
  * @author Michael Grossen
  */
 /**
  * @author Michael Grossen
  */
-public class DataHandlerForTestsTest{
+public class DataHandlerForTestsTest {
 
        private DateRangeFactory factory;
        private Reservation testReservation;
 
        private DateRangeFactory factory;
        private Reservation testReservation;
-       private Reservation testReservation2; //same ID as testReservation
+       private Reservation testReservation2; // same ID as testReservation
        private Reservation testReservation3;
        private Reservation testReservation4;
        private Reservation testReservation5;
        private Reservation testReservation3;
        private Reservation testReservation4;
        private Reservation testReservation5;
@@ -47,7 +47,8 @@ public class DataHandlerForTestsTest{
 
                User testUser = new User("TestUser", "pass");
                Resource testResource = new Resource("TestResource", "TestType");
 
                User testUser = new User("TestUser", "pass");
                Resource testResource = new Resource("TestResource", "TestType");
-               DateRange testDr = factory.createDateRange(DateFactory.createDate(2015, 11, 9), DateFactory.createDate(2015, 11, 13));
+               DateRange testDr = factory.createDateRange(DateFactory.createDate(2015, 11, 9),
+                               DateFactory.createDate(2015, 11, 13));
                UUID groupid = UUID.randomUUID();
                testReservation = new Reservation(groupid, testUser, testResource, testDr, "TestReservation");
 
                UUID groupid = UUID.randomUUID();
                testReservation = new Reservation(groupid, testUser, testResource, testDr, "TestReservation");
 
@@ -56,23 +57,25 @@ public class DataHandlerForTestsTest{
 
                User testUser3 = new User("TestUser3", "pass3");
                Resource testResource3 = new Resource("TestResource3", "TestType3");
 
                User testUser3 = new User("TestUser3", "pass3");
                Resource testResource3 = new Resource("TestResource3", "TestType3");
-               DateRange testDr3 = factory.createDateRange(DateFactory.createDate(2016, 11, 9), DateFactory.createDate(2016, 11, 13));
+               DateRange testDr3 = factory.createDateRange(DateFactory.createDate(2016, 11, 9),
+                               DateFactory.createDate(2016, 11, 13));
                testReservation3 = new Reservation(groupid, testUser3, testResource3, testDr3, "TestReservation3");
 
                User testUser4 = new User("TestUser4", "pass4");
                Resource testResource4 = new Resource("TestResource4", "TestType4");
                testReservation3 = new Reservation(groupid, testUser3, testResource3, testDr3, "TestReservation3");
 
                User testUser4 = new User("TestUser4", "pass4");
                Resource testResource4 = new Resource("TestResource4", "TestType4");
-               DateRange testDr4 = factory.createDateRange(DateFactory.createDate(2017, 11, 9), DateFactory.createDate(2017, 11, 13));
+               DateRange testDr4 = factory.createDateRange(DateFactory.createDate(2017, 11, 9),
+                               DateFactory.createDate(2017, 11, 13));
                UUID groupid4 = UUID.randomUUID();
                testReservation4 = new Reservation(groupid4, testUser4, testResource4, testDr4, "TestReservation4");
 
                UUID groupid4 = UUID.randomUUID();
                testReservation4 = new Reservation(groupid4, testUser4, testResource4, testDr4, "TestReservation4");
 
-               
-               DateRange testDr5 = factory.createDateRange(DateFactory.createDate(2015, 11, 10), DateFactory.createDate(2015, 11, 14));
+               DateRange testDr5 = factory.createDateRange(DateFactory.createDate(2015, 11, 10),
+                               DateFactory.createDate(2015, 11, 14));
                testReservation5 = new Reservation(groupid, testUser, testResource, testDr5, "TestReservation5");
                testReservation5 = new Reservation(groupid, testUser, testResource, testDr5, "TestReservation5");
-               
+
        }
 
        @Test
        }
 
        @Test
-       public void addUserTest() throws Exception{
+       public void addUserTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                User testUser = null;
                try {
                DataHandler dh = new DataHandlerForTests();
                User testUser = null;
                try {
@@ -83,15 +86,15 @@ public class DataHandlerForTestsTest{
                dh.addUser(testUser);
        }
 
                dh.addUser(testUser);
        }
 
-       @Test(expected=IllegalArgumentException.class)
-       public void addIllegalUserTest() throws Exception{
+       @Test(expected = IllegalArgumentException.class)
+       public void addIllegalUserTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                User testUser = null;
                dh.addUser(testUser);
        }
 
        @Test
                DataHandler dh = new DataHandlerForTests();
                User testUser = null;
                dh.addUser(testUser);
        }
 
        @Test
-       public void addSameUserTest() throws Exception{
+       public void addSameUserTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                User testUser = null;
                try {
                DataHandler dh = new DataHandlerForTests();
                User testUser = null;
                try {
@@ -104,7 +107,7 @@ public class DataHandlerForTestsTest{
        }
 
        @Test
        }
 
        @Test
-       public void findUserTest() throws Exception{
+       public void findUserTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                User addedUser = new User("TestUser", "pass");
                dh.addUser(addedUser);
                DataHandler dh = new DataHandlerForTests();
                User addedUser = new User("TestUser", "pass");
                dh.addUser(addedUser);
@@ -113,7 +116,7 @@ public class DataHandlerForTestsTest{
        }
 
        @Test
        }
 
        @Test
-       public void findNotAddedUser() throws Exception{
+       public void findNotAddedUser() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                assertEquals(null, dh.findUser("notAddedUser"));
                User addedUser = new User("TestUser", "pass");
                DataHandler dh = new DataHandlerForTests();
                assertEquals(null, dh.findUser("notAddedUser"));
                User addedUser = new User("TestUser", "pass");
@@ -122,7 +125,7 @@ public class DataHandlerForTestsTest{
        }
 
        @Test
        }
 
        @Test
-       public void addResourceTest() throws Exception{
+       public void addResourceTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                Resource testResource = null;
                try {
                DataHandler dh = new DataHandlerForTests();
                Resource testResource = null;
                try {
@@ -134,11 +137,12 @@ public class DataHandlerForTestsTest{
        }
 
        @Test
        }
 
        @Test
-       public void addSameResourceTest() throws Exception{
+       public void addSameResourceTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                Resource testResource = null;
                try {
                DataHandler dh = new DataHandlerForTests();
                Resource testResource = null;
                try {
-                       testResource = new Resource("TestResource", "TestType");;
+                       testResource = new Resource("TestResource", "TestType");
+                       ;
                } catch (Exception e) {
                        fail("Check UserTest (Exception was thrown by Resource Cunstructor)!");
                }
                } catch (Exception e) {
                        fail("Check UserTest (Exception was thrown by Resource Cunstructor)!");
                }
@@ -146,23 +150,24 @@ public class DataHandlerForTestsTest{
                assertEquals(false, dh.addResource(testResource));
        }
 
                assertEquals(false, dh.addResource(testResource));
        }
 
-       @Test(expected=IllegalArgumentException.class)
-       public void addIllegalResourceTest() throws Exception{
+       @Test(expected = IllegalArgumentException.class)
+       public void addIllegalResourceTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                Resource testResource = null;
                dh.addResource(testResource);
        }
 
        @Test
                DataHandler dh = new DataHandlerForTests();
                Resource testResource = null;
                dh.addResource(testResource);
        }
 
        @Test
-       public void findResourceTest() throws Exception{
+       public void findResourceTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                Resource addedResource = new Resource("TestResource", "TestType");
                dh.addResource(addedResource);
                Resource foundResource = dh.findResource("TestResource");
                assertEquals(addedResource.getName(), foundResource.getName());
        }
                DataHandler dh = new DataHandlerForTests();
                Resource addedResource = new Resource("TestResource", "TestType");
                dh.addResource(addedResource);
                Resource foundResource = dh.findResource("TestResource");
                assertEquals(addedResource.getName(), foundResource.getName());
        }
+
        @Test
        @Test
-       public void findNoResourceTest() throws Exception{
+       public void findNoResourceTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                Resource addedResource = new Resource("TestResource", "TestType");
                Resource addedResource2 = new Resource("TestResource2", "TestType2");
                DataHandler dh = new DataHandlerForTests();
                Resource addedResource = new Resource("TestResource", "TestType");
                Resource addedResource2 = new Resource("TestResource2", "TestType2");
@@ -172,7 +177,7 @@ public class DataHandlerForTestsTest{
        }
 
        @Test
        }
 
        @Test
-       public void addResourceSameIdTest() throws Exception{
+       public void addResourceSameIdTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                Resource addedResource = new Resource("TestResource", "TestType");
                Resource addedResource2 = addedResource.clone();
                DataHandler dh = new DataHandlerForTests();
                Resource addedResource = new Resource("TestResource", "TestType");
                Resource addedResource2 = addedResource.clone();
@@ -183,13 +188,13 @@ public class DataHandlerForTestsTest{
        }
 
        @Test
        }
 
        @Test
-       public void addReservationTest() throws Exception{
+       public void addReservationTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                dh.addReservation(testReservation);
        }
 
        @Test
                DataHandler dh = new DataHandlerForTests();
                dh.addReservation(testReservation);
        }
 
        @Test
-       public void findReservationTest() throws Exception{
+       public void findReservationTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                UUID testId = testReservation.getId();
                dh.addReservation(testReservation);
                DataHandler dh = new DataHandlerForTests();
                UUID testId = testReservation.getId();
                dh.addReservation(testReservation);
@@ -199,7 +204,7 @@ public class DataHandlerForTestsTest{
        }
 
        @Test
        }
 
        @Test
-       public void findReservationFalseIdTest() throws Exception{
+       public void findReservationFalseIdTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                dh.addReservation(testReservation);
 
                DataHandler dh = new DataHandlerForTests();
                dh.addReservation(testReservation);
 
@@ -207,7 +212,7 @@ public class DataHandlerForTestsTest{
        }
 
        @Test
        }
 
        @Test
-       public void editReservationTest() throws Exception{
+       public void editReservationTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                dh.addReservation(testReservation);
 
                DataHandler dh = new DataHandlerForTests();
                dh.addReservation(testReservation);
 
@@ -217,39 +222,39 @@ public class DataHandlerForTestsTest{
        }
 
        @Test
        }
 
        @Test
-       public void editReservationFalseIdTest() throws Exception{
+       public void editReservationFalseIdTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                dh.addReservation(testReservation);
 
                assertEquals(false, dh.editReservation(testReservation3));
        }
 
                DataHandler dh = new DataHandlerForTests();
                dh.addReservation(testReservation);
 
                assertEquals(false, dh.editReservation(testReservation3));
        }
 
-       @Test(expected=IllegalArgumentException.class)
-       public void findGroupReservationsNullTest() throws Exception{
+       @Test(expected = IllegalArgumentException.class)
+       public void findGroupReservationsNullTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                dh.findGroupReservations(null);
        }
 
                DataHandler dh = new DataHandlerForTests();
                dh.findGroupReservations(null);
        }
 
-       @Test(expected=IllegalArgumentException.class)
-       public void userReservationsNullTest() throws Exception{
+       @Test(expected = IllegalArgumentException.class)
+       public void userReservationsNullTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                dh.userReservations(null);
        }
 
                DataHandler dh = new DataHandlerForTests();
                dh.userReservations(null);
        }
 
-       @Test(expected=IllegalArgumentException.class)
-       public void overlapsNullTest() throws Exception{
+       @Test(expected = IllegalArgumentException.class)
+       public void overlapsNullTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                dh.overlaps(null);
        }
 
                DataHandler dh = new DataHandlerForTests();
                dh.overlaps(null);
        }
 
-       @Test(expected=IllegalArgumentException.class)
-       public void addReservationNullTest() throws Exception{
+       @Test(expected = IllegalArgumentException.class)
+       public void addReservationNullTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                dh.addReservation(null);
        }
 
        @Test
                DataHandler dh = new DataHandlerForTests();
                dh.addReservation(null);
        }
 
        @Test
-       public void addSameReservationTest() throws Exception{
+       public void addSameReservationTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
 
                dh.addReservation(testReservation);
                DataHandler dh = new DataHandlerForTests();
 
                dh.addReservation(testReservation);
@@ -257,50 +262,50 @@ public class DataHandlerForTestsTest{
                assertEquals(false, dh.addReservation(testReservation2));
 
        }
                assertEquals(false, dh.addReservation(testReservation2));
 
        }
-       
+
        @Test
        @Test
-       public void addReservationSameDateTest() throws Exception{
+       public void addReservationSameDateTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
 
                dh.addReservation(testReservation);
                assertEquals(false, dh.addReservation(testReservation5));
        }
 
                DataHandler dh = new DataHandlerForTests();
 
                dh.addReservation(testReservation);
                assertEquals(false, dh.addReservation(testReservation5));
        }
 
-       @Test(expected=IllegalArgumentException.class)
-       public void editReservationNullTest() throws Exception{
+       @Test(expected = IllegalArgumentException.class)
+       public void editReservationNullTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                dh.editReservation(null);
        }
 
                DataHandler dh = new DataHandlerForTests();
                dh.editReservation(null);
        }
 
-       @Test(expected=IllegalArgumentException.class)
-       public void deleteReservationsNullTest() throws Exception{
+       @Test(expected = IllegalArgumentException.class)
+       public void deleteReservationsNullTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                dh.deleteReservation(null);
        }
 
        @Test
                DataHandler dh = new DataHandlerForTests();
                dh.deleteReservation(null);
        }
 
        @Test
-       public void deleteReservationsFailTest() throws Exception{
+       public void deleteReservationsFailTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                dh.addReservation(testReservation);
                assertEquals(true, dh.deleteReservation(testReservation));
                assertEquals(false, dh.deleteReservation(testReservation2));
        }
 
                DataHandler dh = new DataHandlerForTests();
                dh.addReservation(testReservation);
                assertEquals(true, dh.deleteReservation(testReservation));
                assertEquals(false, dh.deleteReservation(testReservation2));
        }
 
-       @Test(expected=Exception.class)
-       public void refreshTest() throws Exception{
+       @Test(expected = Exception.class)
+       public void refreshTest() throws Exception {
                DataHandler dh = new DataHandlerForTests();
                dh.refresh(true);
        }
 
        @Test
                DataHandler dh = new DataHandlerForTests();
                dh.refresh(true);
        }
 
        @Test
-       public void findAllReservationsTest() throws Exception{
+       public void findAllReservationsTest() throws Exception {
                List<Reservation> allReservations = new ArrayList<Reservation>();
                DataHandler dh = new DataHandlerForTests();
                dh.addReservation(testReservation);
                dh.addReservation(testReservation3);
                dh.addReservation(testReservation4);
                allReservations = dh.findAllReservations();
                List<Reservation> allReservations = new ArrayList<Reservation>();
                DataHandler dh = new DataHandlerForTests();
                dh.addReservation(testReservation);
                dh.addReservation(testReservation3);
                dh.addReservation(testReservation4);
                allReservations = dh.findAllReservations();
-                       
+
                assertEquals(3, allReservations.size());
        }
 }
                assertEquals(3, allReservations.size());
        }
 }
index a48b593..c4c7a39 100644 (file)
@@ -40,8 +40,9 @@ public class ReservationTest {
                Resource testResource = new Resource("N321", "class room");\r
                DateRange testDr = factory.createDateRange(DateFactory.createDate(2015, 11, 9),\r
                                DateFactory.createDate(2015, 11, 13));\r
                Resource testResource = new Resource("N321", "class room");\r
                DateRange testDr = factory.createDateRange(DateFactory.createDate(2015, 11, 9),\r
                                DateFactory.createDate(2015, 11, 13));\r
-               Reservation testReservation = new Reservation(UUID.randomUUID(), testUser, testResource, testDr, "TestReservation");\r
-               \r
+               Reservation testReservation = new Reservation(UUID.randomUUID(), testUser, testResource, testDr,\r
+                               "TestReservation");\r
+\r
                assertNotEquals(null, testReservation.getId());\r
                assertNotEquals(null, testReservation.getGroupId());\r
                assertEquals(testUser, testReservation.getUser());\r
                assertNotEquals(null, testReservation.getId());\r
                assertNotEquals(null, testReservation.getGroupId());\r
                assertEquals(testUser, testReservation.getUser());\r
@@ -49,14 +50,15 @@ public class ReservationTest {
                assertEquals(testDr, testReservation.getDateRange());\r
                assertEquals("TestReservation", testReservation.getRemark());\r
        }\r
                assertEquals(testDr, testReservation.getDateRange());\r
                assertEquals("TestReservation", testReservation.getRemark());\r
        }\r
-       \r
+\r
        @Test\r
        public void setAndGetNameTest() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                Resource testResource = new Resource("N321", "class room");\r
                DateRange testDr = factory.createDateRange(DateFactory.createDate(2015, 11, 9),\r
                                DateFactory.createDate(2015, 11, 13));\r
        @Test\r
        public void setAndGetNameTest() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                Resource testResource = new Resource("N321", "class room");\r
                DateRange testDr = factory.createDateRange(DateFactory.createDate(2015, 11, 9),\r
                                DateFactory.createDate(2015, 11, 13));\r
-               Reservation testReservation = new Reservation(UUID.randomUUID(), testUser, testResource, testDr, "TestReservation");\r
+               Reservation testReservation = new Reservation(UUID.randomUUID(), testUser, testResource, testDr,\r
+                               "TestReservation");\r
 \r
                testReservation.setRemark("otherTestReservation");\r
                assertEquals("otherTestReservation", testReservation.getRemark());\r
 \r
                testReservation.setRemark("otherTestReservation");\r
                assertEquals("otherTestReservation", testReservation.getRemark());\r
@@ -68,7 +70,8 @@ public class ReservationTest {
                Resource testResource = new Resource("N321", "class room");\r
                DateRange testDr = factory.createDateRange(DateFactory.createDate(2015, 11, 9),\r
                                DateFactory.createDate(2015, 11, 13));\r
                Resource testResource = new Resource("N321", "class room");\r
                DateRange testDr = factory.createDateRange(DateFactory.createDate(2015, 11, 9),\r
                                DateFactory.createDate(2015, 11, 13));\r
-               Reservation testReservation = new Reservation(UUID.randomUUID(), testUser, testResource, testDr, "TestReservation");\r
+               Reservation testReservation = new Reservation(UUID.randomUUID(), testUser, testResource, testDr,\r
+                               "TestReservation");\r
 \r
                User otherTestUser = new User("otherTestUser", "pass");\r
                testReservation.setUser(otherTestUser);\r
 \r
                User otherTestUser = new User("otherTestUser", "pass");\r
                testReservation.setUser(otherTestUser);\r
@@ -81,7 +84,8 @@ public class ReservationTest {
                Resource testResource = new Resource("N321", "class room");\r
                DateRange testDr = factory.createDateRange(DateFactory.createDate(2015, 11, 9),\r
                                DateFactory.createDate(2015, 11, 13));\r
                Resource testResource = new Resource("N321", "class room");\r
                DateRange testDr = factory.createDateRange(DateFactory.createDate(2015, 11, 9),\r
                                DateFactory.createDate(2015, 11, 13));\r
-               Reservation testReservation = new Reservation(UUID.randomUUID(), testUser, testResource, testDr, "TestReservation");\r
+               Reservation testReservation = new Reservation(UUID.randomUUID(), testUser, testResource, testDr,\r
+                               "TestReservation");\r
 \r
                Resource OtherTestResource = new Resource("N421", "lecture hall");\r
                testReservation.setResource(OtherTestResource);\r
 \r
                Resource OtherTestResource = new Resource("N421", "lecture hall");\r
                testReservation.setResource(OtherTestResource);\r
@@ -94,7 +98,8 @@ public class ReservationTest {
                Resource testResource = new Resource("N321", "class room");\r
                DateRange testDr = factory.createDateRange(DateFactory.createDate(2015, 11, 9),\r
                                DateFactory.createDate(2015, 11, 13));\r
                Resource testResource = new Resource("N321", "class room");\r
                DateRange testDr = factory.createDateRange(DateFactory.createDate(2015, 11, 9),\r
                                DateFactory.createDate(2015, 11, 13));\r
-               Reservation testReservation = new Reservation(UUID.randomUUID(), testUser, testResource, testDr, "TestReservation");\r
+               Reservation testReservation = new Reservation(UUID.randomUUID(), testUser, testResource, testDr,\r
+                               "TestReservation");\r
 \r
                DateRange otherTestDr = factory.createDateRange(DateFactory.createDate(2015, 12, 9),\r
                                DateFactory.createDate(2015, 12, 13));\r
 \r
                DateRange otherTestDr = factory.createDateRange(DateFactory.createDate(2015, 12, 9),\r
                                DateFactory.createDate(2015, 12, 13));\r
index 73af912..6e5b1f6 100644 (file)
@@ -24,11 +24,11 @@ public class ResourceTest {
                assertEquals("class room", testResource.getType());\r
        }\r
 \r
                assertEquals("class room", testResource.getType());\r
        }\r
 \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void createUserInvalidNameTest() throws Exception{\r
+       @Test(expected = IllegalArgumentException.class)\r
+       public void createUserInvalidNameTest() throws Exception {\r
                Resource testResource = new Resource(null, "class room");\r
        }\r
                Resource testResource = new Resource(null, "class room");\r
        }\r
-       \r
+\r
        @Test\r
        public void setAndGetNameTest() throws Exception {\r
                Resource testRessource = new Resource("N321", "class room");\r
        @Test\r
        public void setAndGetNameTest() throws Exception {\r
                Resource testRessource = new Resource("N321", "class room");\r
index 01b759d..51696d3 100644 (file)
@@ -20,26 +20,29 @@ import ch.bfh.ti.srs.extern.Password;
  * @author Michael Grossen\r
  */\r
 public class UserTest {\r
  * @author Michael Grossen\r
  */\r
 public class UserTest {\r
-       //@Rule\r
-       //public ExpectedException createUserException = ExpectedException.none();\r
-       \r
+       // @Rule\r
+       // public ExpectedException createUserException = ExpectedException.none();\r
+\r
        @Test\r
        @Test\r
-       public void createUserTest() throws Exception{\r
+       public void createUserTest() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                assertEquals("TestUser", testUser.getUserName());\r
                User testUser = new User("TestUser", "pass");\r
                assertEquals("TestUser", testUser.getUserName());\r
-               \r
-               //Zweite Moeglichkeit um Exceptions zu testen, so lange keine Exception erwartet wird reicht es\r
-               //eine allfaellige mit 'throws Exception' an junit weiterzuleiten.\r
-               //--------------------------------------------------------------------------------------------\r
-               /*createUserException.expect(IllegalArgumentException.class);\r
-               createUserException.expectMessage("Invalid username");\r
-               User wrongArgumentUser1 = new User(null, "1234");\r
-               createUserException.expectMessage("Invalid password");\r
-               User wrongArgumentUser2 = new User("TestUser2", null);*/\r
-       }\r
-       \r
+\r
+               // Zweite Moeglichkeit um Exceptions zu testen, so lange keine Exception\r
+               // erwartet wird reicht es\r
+               // eine allfaellige mit 'throws Exception' an junit weiterzuleiten.\r
+               // --------------------------------------------------------------------------------------------\r
+               /*\r
+                * createUserException.expect(IllegalArgumentException.class);\r
+                * createUserException.expectMessage("Invalid username"); User\r
+                * wrongArgumentUser1 = new User(null, "1234");\r
+                * createUserException.expectMessage("Invalid password"); User\r
+                * wrongArgumentUser2 = new User("TestUser2", null);\r
+                */\r
+       }\r
+\r
        @Test\r
        @Test\r
-       public void createExistingTest() throws Exception{\r
+       public void createExistingTest() throws Exception {\r
                User testUser = new User("TestUser", "pass", "grosm9@bfh.ch", "Test", "Dummy");\r
                assertEquals("TestUser", testUser.getUserName());\r
                assertEquals("pass", testUser.getEncryptedPassword());\r
                User testUser = new User("TestUser", "pass", "grosm9@bfh.ch", "Test", "Dummy");\r
                assertEquals("TestUser", testUser.getUserName());\r
                assertEquals("pass", testUser.getEncryptedPassword());\r
@@ -47,45 +50,45 @@ public class UserTest {
                assertEquals("Test", testUser.getName());\r
                assertEquals("Dummy", testUser.getLastname());\r
        }\r
                assertEquals("Test", testUser.getName());\r
                assertEquals("Dummy", testUser.getLastname());\r
        }\r
-       \r
+\r
        @Test\r
        @Test\r
-       public void getEncryptedPasswordTest() throws Exception{\r
+       public void getEncryptedPasswordTest() throws Exception {\r
                String encryptedPass = Password.getSaltedHash("testPassword");\r
                User testUser = new User("TestUser", encryptedPass, "grosm9@bfh.ch", "Test", "Dummy");\r
                assertEquals(encryptedPass, testUser.getEncryptedPassword());\r
        }\r
                String encryptedPass = Password.getSaltedHash("testPassword");\r
                User testUser = new User("TestUser", encryptedPass, "grosm9@bfh.ch", "Test", "Dummy");\r
                assertEquals(encryptedPass, testUser.getEncryptedPassword());\r
        }\r
-       \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void createUserInvalidUsernameTest() throws Exception{\r
-               User testUser = new User(null,"pass");\r
+\r
+       @Test(expected = IllegalArgumentException.class)\r
+       public void createUserInvalidUsernameTest() throws Exception {\r
+               User testUser = new User(null, "pass");\r
        }\r
        }\r
-       \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void createUserTooShortUsernameTest() throws Exception{\r
-               User testUser = new User(new String(),"pass");\r
-               User testUser2 = new User(new String("tes"),"pass");\r
+\r
+       @Test(expected = IllegalArgumentException.class)\r
+       public void createUserTooShortUsernameTest() throws Exception {\r
+               User testUser = new User(new String(), "pass");\r
+               User testUser2 = new User(new String("tes"), "pass");\r
        }\r
        }\r
-       \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void createUserInvalidPasswordTest() throws Exception{\r
+\r
+       @Test(expected = IllegalArgumentException.class)\r
+       public void createUserInvalidPasswordTest() throws Exception {\r
                User testUser = new User("TestUser", null);\r
        }\r
 \r
        @Test\r
                User testUser = new User("TestUser", null);\r
        }\r
 \r
        @Test\r
-       public void checkPasswordTest() throws Exception{\r
+       public void checkPasswordTest() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                assertTrue(testUser.checkPassword("pass"));\r
                assertFalse(testUser.checkPassword("notmypass"));\r
        }\r
                User testUser = new User("TestUser", "pass");\r
                assertTrue(testUser.checkPassword("pass"));\r
                assertFalse(testUser.checkPassword("notmypass"));\r
        }\r
-       \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void checkPasswordInvalidTest() throws Exception{\r
+\r
+       @Test(expected = IllegalArgumentException.class)\r
+       public void checkPasswordInvalidTest() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                assertTrue(testUser.checkPassword(null));\r
        }\r
                User testUser = new User("TestUser", "pass");\r
                assertTrue(testUser.checkPassword(null));\r
        }\r
-       \r
+\r
        @Test\r
        @Test\r
-       public void changePasswordTest() throws Exception{\r
+       public void changePasswordTest() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                assertTrue(testUser.checkPassword("pass"));\r
                testUser.changePassword("newpass");\r
                User testUser = new User("TestUser", "pass");\r
                assertTrue(testUser.checkPassword("pass"));\r
                testUser.changePassword("newpass");\r
@@ -93,46 +96,46 @@ public class UserTest {
                assertFalse(testUser.checkPassword("pass"));\r
                assertFalse(testUser.checkPassword("notmypass"));\r
        }\r
                assertFalse(testUser.checkPassword("pass"));\r
                assertFalse(testUser.checkPassword("notmypass"));\r
        }\r
-       \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void changePasswordInvalid1Test() throws Exception{\r
+\r
+       @Test(expected = IllegalArgumentException.class)\r
+       public void changePasswordInvalid1Test() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                testUser.changePassword(null);\r
        }\r
                User testUser = new User("TestUser", "pass");\r
                testUser.changePassword(null);\r
        }\r
-       \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void changePasswordInvalid2Test() throws Exception{\r
+\r
+       @Test(expected = IllegalArgumentException.class)\r
+       public void changePasswordInvalid2Test() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                testUser.changePassword("pass");\r
        }\r
 \r
        @Test\r
                User testUser = new User("TestUser", "pass");\r
                testUser.changePassword("pass");\r
        }\r
 \r
        @Test\r
-       public void setMailTest() throws Exception{\r
+       public void setMailTest() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                testUser.setMail("grosm9@bfh.ch");\r
        }\r
                User testUser = new User("TestUser", "pass");\r
                testUser.setMail("grosm9@bfh.ch");\r
        }\r
-       \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void setMailIllegal1Test() throws Exception{\r
+\r
+       @Test(expected = IllegalArgumentException.class)\r
+       public void setMailIllegal1Test() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                testUser.setMail("fda.ds");\r
 \r
        }\r
                User testUser = new User("TestUser", "pass");\r
                testUser.setMail("fda.ds");\r
 \r
        }\r
-       \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void setMailIllegal2Test() throws Exception{\r
+\r
+       @Test(expected = IllegalArgumentException.class)\r
+       public void setMailIllegal2Test() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                testUser.setMail("adfiug@fs");\r
        }\r
                User testUser = new User("TestUser", "pass");\r
                testUser.setMail("adfiug@fs");\r
        }\r
-       \r
-       @Test(expected=IllegalArgumentException.class)\r
-       public void setMailIllegal3Test() throws Exception{\r
+\r
+       @Test(expected = IllegalArgumentException.class)\r
+       public void setMailIllegal3Test() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                testUser.setMail(null);\r
        }\r
 \r
        @Test\r
                User testUser = new User("TestUser", "pass");\r
                testUser.setMail(null);\r
        }\r
 \r
        @Test\r
-       public void getMailTest() throws Exception{\r
+       public void getMailTest() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                String mail = "grosm9@bfh.ch";\r
 \r
                User testUser = new User("TestUser", "pass");\r
                String mail = "grosm9@bfh.ch";\r
 \r
@@ -141,16 +144,16 @@ public class UserTest {
        }\r
 \r
        @Test\r
        }\r
 \r
        @Test\r
-       public void setAndGetNameTest() throws Exception{\r
+       public void setAndGetNameTest() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                testUser.setName("Tester");\r
                User testUser = new User("TestUser", "pass");\r
                testUser.setName("Tester");\r
-               assertEquals("Tester",testUser.getName());\r
+               assertEquals("Tester", testUser.getName());\r
                testUser.setName(null);\r
                assertEquals(null, testUser.getName());\r
        }\r
 \r
        @Test\r
                testUser.setName(null);\r
                assertEquals(null, testUser.getName());\r
        }\r
 \r
        @Test\r
-       public void setAndGetLastnameTest() throws Exception{\r
+       public void setAndGetLastnameTest() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                testUser.setLastname("Dummy");\r
                assertEquals("Dummy", testUser.getLastname());\r
                User testUser = new User("TestUser", "pass");\r
                testUser.setLastname("Dummy");\r
                assertEquals("Dummy", testUser.getLastname());\r