fixed checkstyle and javadoc warnings
authorDominik <muggd1@bfh.ch>
Sun, 10 Jan 2016 11:16:35 +0000 (12:16 +0100)
committerDominik <muggd1@bfh.ch>
Sun, 10 Jan 2016 11:16:35 +0000 (12:16 +0100)
16 files changed:
src/main/java/ch/bfh/ti/srs/controller/Controller.java
src/main/java/ch/bfh/ti/srs/controller/ResourceManagerController.java
src/main/java/ch/bfh/ti/srs/controller/SessionController.java
src/main/java/ch/bfh/ti/srs/controller/UserController.java
src/main/java/ch/bfh/ti/srs/datahandler/DataHandler.java
src/main/java/ch/bfh/ti/srs/dataschema/Modifiable.java
src/main/java/ch/bfh/ti/srs/dataschema/Reservation.java
src/main/java/ch/bfh/ti/srs/dataschema/Role.java
src/main/java/ch/bfh/ti/srs/dataschema/User.java
src/test/java/ch/bfh/ti/srs/controller/ResourceManagerControllerTest.java
src/test/java/ch/bfh/ti/srs/controller/SessionControllerTest.java
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 296045f..232dfa5 100644 (file)
@@ -5,9 +5,6 @@
  *\r
  * Distributable under GPL license. See terms of license at gnu.org.\r
  */\r
-/**\r
- * \r
- */\r
 package ch.bfh.ti.srs.controller;\r
 \r
 import java.rmi.AlreadyBoundException;\r
@@ -27,18 +24,18 @@ import ch.bfh.ti.srs.dataschema.User;
 \r
 /**\r
  * @author Michael\r
- *\r
  */\r
 public abstract class Controller {\r
        protected DataHandler dh;\r
        protected SessionController sc;\r
 \r
-       \r
        /**\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
+        * @param sc\r
+        *            SessionController which is responsable for the login\r
         */\r
        public Controller(DataHandler dh, SessionController sc) {\r
                this.dh = dh;\r
@@ -107,9 +104,10 @@ public abstract class Controller {
         *             <code>DataHandler</code> is set\r
         */\r
        public Map<Reservation, Boolean> getReservationsInDateRange(DateRange dateRange) throws Exception {\r
-//             Not needed at the moment since this check is already done in UserController\r
-//             if (dh == null)\r
-//                     throw new Exception("No DataHandler set");\r
+               // Not needed at the moment since this check is already done in\r
+               // UserController\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
@@ -134,12 +132,13 @@ public abstract class Controller {
         *             logged in while user param = null\r
         */\r
        public Map<Reservation, Boolean> getUserReservations_Super(User user) throws Exception {\r
-//             Not needed at the moment since this check is already done in UserController\r
-//             if (dh == null)\r
-//                     throw new Exception("No DataHandler set");\r
-//             if (user == null) {\r
-//                     throw new Exception("user must be defined");\r
-//             }\r
+               // Not needed at the moment since this check is already done in\r
+               // UserController\r
+               // if (dh == null)\r
+               // throw new Exception("No DataHandler set");\r
+               // if (user == null) {\r
+               // throw new Exception("user must be defined");\r
+               // }\r
 \r
                // Could be swapped out to private method for better performance (just\r
                // check sc.getLoggedUser() once)\r
@@ -161,9 +160,10 @@ public abstract class Controller {
         *             No DataHandler set or id null\r
         */\r
        public Reservation getReservation(UUID id) throws Exception {\r
-//             Not needed at the moment since this check is already done in UserController\r
-//             if (dh == null)\r
-//                     throw new Exception("No DataHandler set");\r
+               // Not needed at the moment since this check is already done in\r
+               // UserController\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
@@ -219,12 +219,14 @@ public abstract class Controller {
         */\r
        public Set<Reservation> makeReservation(User user, Resource resource, List<DateRange> dateRangeList, String remark)\r
                        throws Exception {\r
-//             Not needed at the moment since this check is already done in UserController\r
-//             if (user == null) {\r
-//                     if (sc.getLoggedUser() == null)\r
-//                             throw new IllegalArgumentException("User must be defined if no user is logged in");\r
-//                     user = sc.getLoggedUser();\r
-//             }\r
+               // Not needed at the moment since this check is already done in\r
+               // UserController\r
+               // if (user == null) {\r
+               // if (sc.getLoggedUser() == null)\r
+               // throw new IllegalArgumentException("User must be defined if no user\r
+               // is logged in");\r
+               // user = sc.getLoggedUser();\r
+               // }\r
                if (resource == null)\r
                        throw new IllegalArgumentException("Resource must be definded");\r
                if (dateRangeList == null)\r
@@ -260,14 +262,15 @@ public abstract class Controller {
         *             not authorized\r
         */\r
        public boolean changeReservation_Super(Reservation reservation) throws Exception {\r
-//             Not needed at the moment since this check is already done in UserController\r
-//             if (dh == null)\r
-//                     throw new Exception("No DataHandler set");\r
-//             if (reservation == null)\r
-//                     throw new IllegalArgumentException("Reservation must be defined");\r
+               // Not needed at the moment since this check is already done in\r
+               // UserController\r
+               // if (dh == null)\r
+               // throw new Exception("No DataHandler set");\r
+               // if (reservation == null)\r
+               // throw new IllegalArgumentException("Reservation must be defined");\r
                return dh.editReservation(reservation);\r
        }\r
-       \r
+\r
        /**\r
         * Deletes the given reservation in the set <code>DataHandler</code>\r
         * referring to the reservation id\r
@@ -282,11 +285,12 @@ public abstract class Controller {
         *             is logged in or logged <code>User</code> is not authorized\r
         */\r
        public boolean deleteReservation_Super(Reservation reservation) throws Exception {\r
-//             Not needed at the moment since this check is already done in UserController\r
-//             if (dh == null)\r
-//                     throw new Exception("No DataHandler set");\r
-//             if (reservation == null)\r
-//                     throw new IllegalArgumentException("Reservation must be defined");\r
+               // Not needed at the moment since this check is already done in\r
+               // UserController\r
+               // if (dh == null)\r
+               // throw new Exception("No DataHandler set");\r
+               // if (reservation == null)\r
+               // throw new IllegalArgumentException("Reservation must be defined");\r
                return dh.deleteReservation(reservation);\r
        }\r
 }\r
index ed52f5b..0d6099d 100644 (file)
@@ -10,18 +10,18 @@ package ch.bfh.ti.srs.controller;
 import ch.bfh.ti.srs.datahandler.DataHandler;\r
 import ch.bfh.ti.srs.dataschema.Resource;\r
 \r
-\r
 public class ResourceManagerController extends Controller {\r
 \r
        public ResourceManagerController(DataHandler dh, SessionController sc) {\r
                super(dh, sc);\r
        }\r
+\r
        /**\r
         * Creates new resource in the set <code>DataHandler</code>\r
-        * @param name \r
-        *                              name of resource\r
-        * @param type \r
-        *                              type of resource\r
+        * @param name\r
+        *            name of resource\r
+        * @param type\r
+        *            type of resource\r
         * @return <code>True</code> Changes saved <code>False</code> Changes could\r
         *         not be saved\r
         * @throws IllegalArgumentException\r
@@ -38,10 +38,10 @@ public class ResourceManagerController extends Controller {
                Resource resource = new Resource(name, type);\r
                return dh.addResource(resource);\r
        }\r
-       \r
+\r
        /**\r
-        * Replaces the given resource in the set <code>DataHandler</code>\r
-        * referring to the resource id\r
+        * Replaces the given resource in the set <code>DataHandler</code> referring\r
+        * to the resource id\r
         * @param resource\r
         *            Copy of the resource to edit\r
         * @return <code>True</code> Changes saved <code>False</code> Changes could\r
@@ -51,17 +51,17 @@ public class ResourceManagerController extends Controller {
         * @throws Exception\r
         *             if no <code>DataHandler</code> is set\r
         */\r
-       public boolean changeResource(Resource resource) throws Exception{\r
+       public boolean changeResource(Resource resource) throws Exception {\r
                if (dh == null)\r
                        throw new Exception("No DataHandler set");\r
                if (resource == null)\r
                        throw new IllegalArgumentException("Resource must be defined");\r
                return dh.editResource(resource);\r
        }\r
-       \r
+\r
        /**\r
-        * Deletes the given resource in the set <code>DataHandler</code>\r
-        * referring to the resource id\r
+        * Deletes the given resource in the set <code>DataHandler</code> referring\r
+        * to the resource id\r
         * @param resource\r
         *            Copy of the resource to edit\r
         * @return <code>True</code> Changes saved <code>False</code> Changes could\r
index 91eb7e0..21d8a70 100644 (file)
@@ -18,18 +18,18 @@ import ch.bfh.ti.srs.dataschema.User;
 public class SessionController {\r
        private Set<Controller> controllers;\r
        private DataHandler dh;\r
-       private User currentUser;       \r
+       private User currentUser;\r
 \r
-       public SessionController(DataHandler dh){\r
+       public SessionController(DataHandler dh) {\r
                this.dh = dh;\r
                controllers = new HashSet<Controller>();\r
        }\r
-       \r
-       public SessionController(){\r
+\r
+       public SessionController() {\r
                this.dh = new DataHandlerForTests();\r
                controllers = new HashSet<Controller>();\r
        }\r
-       \r
+\r
        /**\r
         * Tries to log in a <code>User</code> with the given credentials\r
         * @param userName\r
@@ -48,18 +48,18 @@ public class SessionController {
                User tempUser = dh.findUser(userName);\r
                if (tempUser == null || !tempUser.checkPassword(password))\r
                        throw new Exception("Username or password wrong");\r
-               else{\r
+               else {\r
                        currentUser = tempUser;\r
                        controllers.clear();\r
-                       \r
+\r
                        for (Role role : currentUser.getRoles()) {\r
-                               switch(role){\r
-                                       case User:\r
-                                               controllers.add(new UserController(dh, this));\r
-                                       case ResourceManager:\r
-                                               controllers.add(new ResourceManagerController(dh, this));\r
-//                                     case Admin:\r
-//                                             //Add AdminController to controllers\r
+                               switch (role) {\r
+                               case User:\r
+                                       controllers.add(new UserController(dh, this));\r
+                               case ResourceManager:\r
+                                       controllers.add(new ResourceManagerController(dh, this));\r
+                                       // case Admin:\r
+                                       // //Add AdminController to controllers\r
                                }\r
                        }\r
                }\r
@@ -151,7 +151,8 @@ public class SessionController {
                return currentUser;\r
        }\r
 \r
-       public void registUser(String userName, String password, String email, String name, String lastname) throws Exception {\r
+       public void registUser(String userName, String password, String email, String name, String lastname)\r
+                       throws Exception {\r
                if (dh == null)\r
                        throw new Exception("No DataHandler set");\r
                User newUser = new User(userName, password);\r
index 6166e91..64217b1 100644 (file)
@@ -20,8 +20,8 @@ import ch.bfh.ti.srs.dataschema.User;
 /**\r
  * @author Michael Grossen\r
  */\r
-public class UserController extends Controller{\r
-       \r
+public class UserController extends Controller {\r
+\r
        public UserController(DataHandler dh, SessionController sc) {\r
                super(dh, sc);\r
        }\r
@@ -78,10 +78,10 @@ public class UserController extends Controller{
                        throw new Exception("No user is logged in");\r
                if (reservation == null)\r
                        throw new IllegalArgumentException("Reservation must be defined");\r
-               if (!reservation.getUser().getUserName().equals(super.sc.getLoggedUser().getUserName())){\r
+               if (!reservation.getUser().getUserName().equals(super.sc.getLoggedUser().getUserName())) {\r
                        throw new Exception("You are not authorized to make this change");\r
                }\r
-                       \r
+\r
                return super.changeReservation_Super(reservation);\r
        }\r
 \r
@@ -111,13 +111,15 @@ public class UserController extends Controller{
        /**\r
         * {@inheritDoc}\r
         */\r
-       public Set<Reservation> makeReservation(User user, Resource resource, List<DateRange> dateRangeList, String remark) throws Exception {\r
-               if (user == null){\r
+       public Set<Reservation> makeReservation(User user, Resource resource, List<DateRange> dateRangeList, String remark)\r
+                       throws Exception {\r
+               if (user == null) {\r
                        if (sc.getLoggedUser() == null)\r
                                throw new IllegalArgumentException("User must be defined if no user is logged in");\r
                        user = sc.getLoggedUser();\r
                }\r
-               if (!user.equals(sc.getLoggedUser())) throw new Exception("You are not authorized to make this reservation");\r
+               if (!user.equals(sc.getLoggedUser()))\r
+                       throw new Exception("You are not authorized to make this reservation");\r
                return super.makeReservation(user, resource, dateRangeList, remark);\r
        }\r
 }\r
index 850f39c..0c964b1 100644 (file)
@@ -45,11 +45,11 @@ public interface DataHandler {
        /**
         * Edit a User with the same Name.
         * @param user
-        *            the new User 
+        *            the new User
         * @return a boolean whether the user was edited or not
         */
        public boolean editUser(User user);
-       
+
        /**
         * Finds the resourceName in the Datacontext and returns the Resource object
         * or null if not found
@@ -143,7 +143,7 @@ public interface DataHandler {
        /**
         * Edit a Reservation with the same ID.
         * @param reservation
-        *            the new Reservation 
+        *            the new Reservation
         * @return a boolean whether the reservation was edited or not
         */
        public boolean editReservation(Reservation reservation);
@@ -159,7 +159,7 @@ public interface DataHandler {
        /**
         * Edit a Resource with the same ID.
         * @param resource
-        *            the new Resource 
+        *            the new Resource
         * @return a boolean whether the resource was edited or not
         */
        public boolean editResource(Resource resource);
@@ -174,10 +174,7 @@ public interface DataHandler {
 
        /**
         * get all the Resources from the datastorage
-        * 
         * @return a set of Resources
         */
        public Set<Resource> getAllResources();
 }
-
-
index 2988655..4fe51e4 100644 (file)
@@ -21,9 +21,5 @@ public interface Modifiable extends Cloneable {
         */\r
        public boolean isModified(Object obj);\r
 \r
-       /*\r
-        * (non-Javadoc)\r
-        * @see java.lang.Object#clone()\r
-        */\r
        public Object clone() throws CloneNotSupportedException;\r
 }\r
index 6a265a3..ca9f5ec 100644 (file)
@@ -22,20 +22,21 @@ public class Reservation implements Modifiable {
 \r
        /**\r
         * Normal constructor for new reservation created in the Controller\r
-        * @param groupId \r
-        *                      id of reservation group when reocuring reservation, 0 when single reservation\r
+        * @param groupId\r
+        *            id of reservation group when reocuring reservation, 0 when\r
+        *            single reservation\r
         * @param user\r
-        *                      user who created the reservation\r
+        *            user who created the reservation\r
         * @param resource\r
-        *                      reserved resource\r
+        *            reserved resource\r
         * @param dateRange\r
-        *                      daterange of the reservation\r
+        *            daterange of the reservation\r
         * @param remark\r
-        *                      remark\r
+        *            remark\r
         * @throws IllegalArgumentException\r
         *             the name of the user and resource can't be null\r
         */\r
-       \r
+\r
        public Reservation(UUID groupId, User user, Resource resource, DateRange dateRange, String remark) {\r
                if (user == null)\r
                        throw new IllegalArgumentException("User must not be null");\r
index 4cff628..08d977f 100644 (file)
@@ -8,7 +8,5 @@
 package ch.bfh.ti.srs.dataschema;\r
 \r
 public enum Role {\r
-       User,\r
-       ResourceManager,\r
-       Admin\r
+       User, ResourceManager, Admin\r
 }\r
index 2409875..109febe 100644 (file)
@@ -154,24 +154,21 @@ public class User implements Cloneable {
                return m.matches();
        }
 
-       /*
-        * (non-Javadoc)
-        * @see java.lang.Object#clone()
-        */
        @Override
        public User clone() throws CloneNotSupportedException {
                return (User) super.clone();
        }
-       
-       public void addRole(Role role){
+
+       public void addRole(Role role) {
                roles.add(role);
        }
-       
-       public void removeRole(Role role){
-               if(roles.contains(role)) roles.remove(role);
+
+       public void removeRole(Role role) {
+               if (roles.contains(role))
+                       roles.remove(role);
        }
-       
-       public Set<Role> getRoles(){
+
+       public Set<Role> getRoles() {
                return roles;
        }
 }
index d2a4d38..add2367 100644 (file)
@@ -15,106 +15,105 @@ import ch.bfh.ti.srs.dataschema.Resource;
 \r
 public class ResourceManagerControllerTest {\r
 \r
-       \r
        @Test\r
        public void AddResourceTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController(dh);\r
+               SessionController sc = new SessionController(dh);\r
                ResourceManagerController rmc = new ResourceManagerController(dh, sc);\r
-               \r
+\r
                rmc.addResource("N321", "class room");\r
        }\r
-       \r
+\r
        @Test\r
        public void ChangeResourceTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController(dh);\r
+               SessionController sc = new SessionController(dh);\r
                ResourceManagerController rmc = new ResourceManagerController(dh, sc);\r
                Resource testResource = new Resource("N321", "class room");\r
-               \r
+\r
                rmc.addResource("N321", "class room");\r
                testResource.setType("lecture hall");\r
                rmc.changeResource(testResource);\r
        }\r
-       \r
+\r
        @Test\r
        public void DeleteResourceTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController(dh);\r
+               SessionController sc = new SessionController(dh);\r
                ResourceManagerController rmc = new ResourceManagerController(dh, sc);\r
                Resource testResource = new Resource("N321", "class room");\r
-               \r
+\r
                rmc.addResource("N321", "class room");\r
                rmc.deleteResource(testResource);\r
        }\r
-       \r
+\r
        @Test(expected = Exception.class)\r
        public void AddResourceInvalidDatahandlerTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController(dh);\r
+               SessionController sc = new SessionController(dh);\r
                ResourceManagerController rmc = new ResourceManagerController(null, sc);\r
-               \r
+\r
                rmc.addResource("N321", "class room");\r
-               \r
+\r
        }\r
-       \r
+\r
        @Test(expected = IllegalArgumentException.class)\r
        public void AddResourceInvalidResourceTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController(dh);\r
+               SessionController sc = new SessionController(dh);\r
                ResourceManagerController rmc = new ResourceManagerController(dh, sc);\r
-               \r
+\r
                rmc.addResource(null, null);\r
        }\r
-       \r
+\r
        @Test(expected = Exception.class)\r
        public void ChangeResourceInvalidDatahandlerTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController(dh);\r
+               SessionController sc = new SessionController(dh);\r
                ResourceManagerController rmc1 = new ResourceManagerController(dh, sc);\r
                ResourceManagerController rmc2 = new ResourceManagerController(null, sc);\r
                Resource testResource = new Resource("N321", "class room");\r
-               \r
+\r
                rmc1.addResource("N321", "class room");\r
                testResource.setType("lecture hall");\r
                rmc2.changeResource(testResource);\r
        }\r
-       \r
+\r
        @Test(expected = IllegalArgumentException.class)\r
        public void ChangeResourceInvalidResourceTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController(dh);\r
+               SessionController sc = new SessionController(dh);\r
                ResourceManagerController rmc = new ResourceManagerController(dh, sc);\r
                Resource testResource = new Resource("N321", "class room");\r
-               \r
+\r
                rmc.addResource("N321", "class room");\r
                testResource = null;\r
                rmc.changeResource(testResource);\r
        }\r
-       \r
+\r
        @Test(expected = Exception.class)\r
        public void DeleteResourceInvalidDatahandlerTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController(dh);\r
+               SessionController sc = new SessionController(dh);\r
                ResourceManagerController rmc1 = new ResourceManagerController(dh, sc);\r
                ResourceManagerController rmc2 = new ResourceManagerController(null, sc);\r
                Resource testResource = new Resource("N321", "class room");\r
-               \r
+\r
                rmc1.addResource("N321", "class room");\r
                rmc2.deleteResource(testResource);\r
-               \r
+\r
        }\r
-       \r
+\r
        @Test(expected = IllegalArgumentException.class)\r
        public void DeleteResourceInvalidResourceTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
-               SessionController  sc = new SessionController(dh);\r
+               SessionController sc = new SessionController(dh);\r
                ResourceManagerController rmc = new ResourceManagerController(dh, sc);\r
                Resource testResource = new Resource("N321", "class room");\r
-               \r
+\r
                rmc.addResource("N321", "class room");\r
                testResource = null;\r
                rmc.deleteResource(testResource);\r
        }\r
-       \r
+\r
 }\r
index 682a5ab..4a0aa3c 100644 (file)
@@ -22,18 +22,19 @@ import ch.bfh.ti.srs.dataschema.User;
 \r
 public class SessionControllerTest {\r
 \r
-       \r
        @Test\r
        public void logInTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
-               SessionController sc2 = new SessionController(); //dummy, just to trigger this constructor..\r
+               SessionController sc2 = new SessionController(); // dummy, just to\r
+                                                                                                                       // trigger this\r
+                                                                                                                       // constructor..\r
 \r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
                sc.registUser("TestUser4", "pass4", "grosm9@bfh.ch", "Test", "User");\r
-               \r
+\r
                Set<Controller> controllers = sc.logIn("TestUser3", "pass3");\r
                assertFalse(controllers.isEmpty());\r
        }\r
@@ -67,7 +68,7 @@ public class SessionControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
 \r
-               //uc.setDataHandler(dh);\r
+               // uc.setDataHandler(dh);\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
@@ -116,7 +117,7 @@ public class SessionControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
 \r
-               //uc.setDataHandler(dh);\r
+               // uc.setDataHandler(dh);\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser3", "pass3", "grosm9@bfh.ch", "Hanfli", null);\r
@@ -141,7 +142,7 @@ public class SessionControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
 \r
-               //uc.setDataHandler(dh);\r
+               // uc.setDataHandler(dh);\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
@@ -177,7 +178,7 @@ public class SessionControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
 \r
-               //uc.setDataHandler(dh);\r
+               // uc.setDataHandler(dh);\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
@@ -204,6 +205,4 @@ public class SessionControllerTest {
                sc.logOut();\r
        }\r
 \r
-\r
-\r
 }\r
index 0d14dab..366f43d 100644 (file)
@@ -41,7 +41,7 @@ public class UserControllerTest {
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser3", "pass3", "grosm9@bfh.ch", "Test", null);\r
                sc.registUser("TestUser4", "pass4", "grosm9@bfh.ch", "Test", "User");\r
-               \r
+\r
                UserController uc = new UserController(dh, sc);\r
                uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
        }\r
@@ -56,10 +56,10 @@ public class UserControllerTest {
        @Test(expected = Exception.class)\r
        public void addUserExceptionTest2() throws Exception {\r
                UserController uc = new UserController(null, null);\r
-               \r
+\r
                uc.addUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
        }\r
-       \r
+\r
        @Test\r
        public void getUserTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
@@ -69,8 +69,8 @@ public class UserControllerTest {
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
                assertEquals("grosm9@bfh.ch", uc.getUser("TestUser1").getMail());\r
        }\r
@@ -79,42 +79,42 @@ public class UserControllerTest {
        public void getUserExceptionTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
-               UserController uc = new UserController(null,sc);\r
+               UserController uc = new UserController(null, sc);\r
 \r
                assertEquals("grosm9@bfh.ch", uc.getUser("TestUser1").getMail());\r
        }\r
-       \r
+\r
        @Test(expected = Exception.class)\r
        public void getUserExpectionTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-                               \r
+\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
-               \r
+\r
                uc.setDataHandler(null);\r
                uc.getUser(null);\r
        }\r
-       \r
+\r
        @SuppressWarnings("deprecation")\r
        @Test\r
        public void getReservationTests() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
-               \r
+\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
@@ -134,7 +134,8 @@ public class UserControllerTest {
                Reservation reservation2 = new Reservation(groupId, sc.getLoggedUser(), resource2, dateRange,\r
                                "Test reservation2");\r
                Reservation reservation3 = new Reservation(groupId, testUser2, resource3, dateRange, "Test reservation3");\r
-               Reservation reservation4 = new Reservation(UUID.randomUUID(), testUser2, resource3, dateRange, "Test reservation3");\r
+               Reservation reservation4 = new Reservation(UUID.randomUUID(), testUser2, resource3, dateRange,\r
+                               "Test reservation3");\r
                dh.addReservation(reservation1);\r
                dh.addReservation(reservation2);\r
                dh.addReservation(reservation3);\r
@@ -146,7 +147,7 @@ public class UserControllerTest {
                Map<Reservation, Boolean> reservationGroupMap = uc.getReservationGroup(groupId);\r
 \r
                assertEquals(reservationDateRangeMap, reservationGroupMap);\r
-               \r
+\r
                assertTrue(loggedUserReservation.containsKey(reservation1));\r
                assertTrue(loggedUserReservation.containsKey(reservation2));\r
                assertFalse(loggedUserReservation.containsKey(reservation3));\r
@@ -168,8 +169,8 @@ public class UserControllerTest {
        public void getReservationGroupException1Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
-               UserController uc = new UserController(dh,sc);\r
-               \r
+               UserController uc = new UserController(dh, sc);\r
+\r
                uc.setDataHandler(null);\r
                uc.getReservationGroup(null);\r
        }\r
@@ -178,8 +179,8 @@ public class UserControllerTest {
        public void getReservationGroupException2Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
-               UserController uc = new UserController(dh,sc);\r
-               \r
+               UserController uc = new UserController(dh, sc);\r
+\r
                uc.getReservationGroup(null);\r
        }\r
 \r
@@ -187,8 +188,8 @@ public class UserControllerTest {
        public void getUserReservationException1Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
-               UserController uc = new UserController(dh,sc);\r
-               \r
+               UserController uc = new UserController(dh, sc);\r
+\r
                uc.setDataHandler(null);\r
                uc.getUserReservations(null);\r
        }\r
@@ -197,8 +198,8 @@ public class UserControllerTest {
        public void getUserReservationException2Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
-               UserController uc = new UserController(dh,sc);\r
-               \r
+               UserController uc = new UserController(dh, sc);\r
+\r
                uc.getUserReservations(null);\r
        }\r
 \r
@@ -206,8 +207,8 @@ public class UserControllerTest {
        public void getReservationException1Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
-               UserController uc = new UserController(dh,sc);\r
-               \r
+               UserController uc = new UserController(dh, sc);\r
+\r
                uc.getReservation(null);\r
        }\r
 \r
@@ -215,8 +216,8 @@ public class UserControllerTest {
        public void getReservationException2Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
-               UserController uc = new UserController(dh,sc);\r
-               \r
+               UserController uc = new UserController(dh, sc);\r
+\r
                uc.getReservation(null);\r
        }\r
 \r
@@ -224,8 +225,8 @@ public class UserControllerTest {
        public void getReservationsInDateRangeException1Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
-               UserController uc = new UserController(dh,sc);\r
-               \r
+               UserController uc = new UserController(dh, sc);\r
+\r
                uc.getReservationsInDateRange(null);\r
        }\r
 \r
@@ -233,8 +234,8 @@ public class UserControllerTest {
        public void getReservationsInDateRangeException2Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
-               UserController uc = new UserController(dh,sc);\r
-               \r
+               UserController uc = new UserController(dh, sc);\r
+\r
                uc.getReservationsInDateRange(null);\r
        }\r
 \r
@@ -244,13 +245,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                Resource resource1 = new Resource("Room101", "Class room");\r
@@ -275,13 +276,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                Resource resource1 = new Resource("Room101", "Class room");\r
@@ -317,13 +318,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                Resource resource1 = new Resource("Room101", "Class room");\r
@@ -348,13 +349,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                Resource resource1 = new Resource("Room101", "Class room");\r
@@ -378,13 +379,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                Resource resource1 = new Resource("Room101", "Class room");\r
@@ -407,13 +408,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                Resource resource1 = new Resource("Room101", "Class room");\r
@@ -427,20 +428,20 @@ public class UserControllerTest {
 \r
                assertEquals(null, uc.makeReservation(null, resource1, dtList, "remark"));\r
        }\r
-       \r
+\r
        @SuppressWarnings("deprecation")\r
        @Test(expected = Exception.class)\r
        public void makeReservationException5Test() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                Resource resource1 = new Resource("Room101", "Class room");\r
@@ -457,20 +458,20 @@ public class UserControllerTest {
 \r
                assertEquals(null, uc.makeReservation(null, resource1, null, "remark"));\r
        }\r
-       \r
+\r
        @SuppressWarnings("deprecation")\r
        @Test\r
        public void changeReservationTest() throws Exception {\r
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                UUID groupId = UUID.randomUUID();\r
@@ -498,13 +499,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                UUID groupId = UUID.randomUUID();\r
@@ -539,13 +540,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                UUID groupId = UUID.randomUUID();\r
@@ -580,13 +581,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                UUID groupId = UUID.randomUUID();\r
@@ -620,13 +621,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                UUID groupId = UUID.randomUUID();\r
@@ -662,13 +663,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                UUID groupId = UUID.randomUUID();\r
@@ -696,13 +697,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                UUID groupId = UUID.randomUUID();\r
@@ -731,13 +732,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                UUID groupId = UUID.randomUUID();\r
@@ -766,13 +767,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                UUID groupId = UUID.randomUUID();\r
@@ -800,13 +801,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                UUID groupId = UUID.randomUUID();\r
@@ -836,13 +837,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                Date start = new Date();\r
@@ -868,13 +869,13 @@ public class UserControllerTest {
                DataHandler dh = new DataHandlerForTests();\r
                SessionController sc = new SessionController(dh);\r
                UserController uc = null;\r
-               \r
+\r
                sc.registUser("TestUser1", "pass1", "grosm9@bfh.ch", null, null);\r
                sc.registUser("TestUser2", "pass2", "grosm9@bfh.ch", null, null);\r
                Set<Controller> controllers = sc.logIn("TestUser1", "pass1");\r
                for (Controller controller : controllers) {\r
-                       if(controller.getClass().equals(UserController.class))\r
-                               uc = (UserController)controller;\r
+                       if (controller.getClass().equals(UserController.class))\r
+                               uc = (UserController) controller;\r
                }\r
 \r
                Date start = new Date();\r
index bfdb9f2..fbca7c3 100644 (file)
@@ -310,71 +310,71 @@ public class DataHandlerForTestsTest {
 
                assertEquals(3, allReservations.size());
        }
-       
+
        @Test
        public void editUserTest() throws Exception {
                DataHandlerForTests dh = new DataHandlerForTests();
-               dh.addUser(new User("TestUser1","pass1"));
-               assertTrue(dh.editUser(new User("TestUser1","pass1")));
+               dh.addUser(new User("TestUser1", "pass1"));
+               assertTrue(dh.editUser(new User("TestUser1", "pass1")));
        }
 
        @Test(expected = IllegalArgumentException.class)
        public void editUserException1Test() throws Exception {
                DataHandlerForTests dh = new DataHandlerForTests();
-               
+
                dh.editUser(null);
        }
-       
+
        @Test
        public void editUserException2Test() throws Exception {
                DataHandlerForTests dh = new DataHandlerForTests();
-               dh.addUser(new User("TestUser1","pass1"));
-               assertFalse(dh.editUser(new User("TestUser2","pass1")));
+               dh.addUser(new User("TestUser1", "pass1"));
+               assertFalse(dh.editUser(new User("TestUser2", "pass1")));
        }
-       
+
        @Test
        public void deleteResourceTest() throws Exception {
                DataHandlerForTests dh = new DataHandlerForTests();
-               
+
                Resource res = new Resource("Room1", "Testroom");
                dh.addResource(res);
                dh.deleteResource(res);
        }
-       
+
        @Test(expected = IllegalArgumentException.class)
        public void deleteResourceExceptionTest() throws Exception {
                DataHandlerForTests dh = new DataHandlerForTests();
-               
+
                dh.deleteResource(null);
        }
 
        @Test
        public void deleteResourceException1Test() throws Exception {
                DataHandlerForTests dh = new DataHandlerForTests();
-               
+
                dh.deleteResource(new Resource("Room1", "Testroom"));
        }
 
        @Test
        public void editResourceTest() throws Exception {
                DataHandlerForTests dh = new DataHandlerForTests();
-               
+
                Resource res = new Resource("Room1", "Testroom");
                dh.addResource(res);
                dh.editResource(res);
        }
-       
+
        @Test(expected = IllegalArgumentException.class)
        public void editResourceExceptionTest() throws Exception {
                DataHandlerForTests dh = new DataHandlerForTests();
-               
+
                dh.editResource(null);
        }
 
        @Test
        public void editResourceException1Test() throws Exception {
                DataHandlerForTests dh = new DataHandlerForTests();
-               
+
                dh.editResource(new Resource("Room1", "Testroom"));
        }
 }
index bfd3093..05256a2 100644 (file)
@@ -134,33 +134,33 @@ public class ReservationTest {
                Reservation testReservation = new Reservation(UUID.randomUUID(), testUser, testResource, testDr,\r
                                "TestReservation");\r
                Reservation clonedTestReservation = testReservation.clone();\r
-               \r
+\r
                assertTrue(testReservation.isModified(null));\r
                assertFalse(testReservation.isModified(testReservation));\r
                assertFalse(testReservation.isModified(clonedTestReservation));\r
-               \r
+\r
                User otherTestUser = new User("otherTestUser", "pass");\r
                clonedTestReservation.setUser(otherTestUser);\r
                assertTrue(testReservation.isModified(clonedTestReservation));\r
-               \r
+\r
                clonedTestReservation.setUser(testUser);\r
                assertFalse(testReservation.isModified(clonedTestReservation));\r
 \r
                Resource otherTestResource = new Resource("N421", "lecture hall");\r
                clonedTestReservation.setResource(otherTestResource);\r
                assertTrue(testReservation.isModified(clonedTestReservation));\r
-               \r
+\r
                clonedTestReservation.setResource(testResource);\r
                assertFalse(testReservation.isModified(clonedTestReservation));\r
-               \r
+\r
                DateRange otherTestDr = factory.createDateRange(DateFactory.createDate(2015, 12, 9),\r
                                DateFactory.createDate(2015, 12, 13));\r
                clonedTestReservation.setDateRange(otherTestDr);\r
                assertTrue(testReservation.isModified(clonedTestReservation));\r
-               \r
+\r
                clonedTestReservation.setDateRange(testDr);\r
                assertFalse(testReservation.isModified(clonedTestReservation));\r
-               \r
+\r
                clonedTestReservation.setRemark("some other remark");\r
                assertTrue(testReservation.isModified(clonedTestReservation));\r
        }\r
index 3e10260..f582f66 100644 (file)
@@ -48,12 +48,12 @@ public class ResourceTest {
                testRessource.setType(null);\r
                assertEquals(null, testRessource.getType());\r
        }\r
-       \r
+\r
        @Test\r
        public void isModifiedTest() throws Exception {\r
                Resource testResource = new Resource("N321", "class room");\r
                Resource clonedTestResource = testResource.clone();\r
-               \r
+\r
                assertFalse(testResource.isModified(clonedTestResource));\r
                assertTrue(testResource.isModified(null));\r
                assertFalse(testResource.isModified(testResource));\r
@@ -65,4 +65,3 @@ public class ResourceTest {
                assertTrue(testResource.isModified(clonedTestResource));\r
        }\r
 }\r
-\r
index 13715cf..91d82e9 100644 (file)
@@ -161,36 +161,36 @@ public class UserTest {
                testUser.setLastname(null);\r
                assertEquals(null, testUser.getLastname());\r
        }\r
-       \r
+\r
        @Test\r
-       public void RoleTest() throws Exception{\r
+       public void RoleTest() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                Set<Role> roles = testUser.getRoles();\r
                assertTrue(roles.contains(Role.User));\r
                assertFalse(roles.contains(Role.ResourceManager));\r
                assertFalse(roles.contains(Role.Admin));\r
-               \r
+\r
                testUser.addRole(Role.ResourceManager);\r
                roles = testUser.getRoles();\r
                assertTrue(roles.contains(Role.User));\r
                assertTrue(roles.contains(Role.ResourceManager));\r
                assertFalse(roles.contains(Role.Admin));\r
-               \r
+\r
                testUser.removeRole(Role.User);\r
                roles = testUser.getRoles();\r
                assertFalse(roles.contains(Role.User));\r
                assertTrue(roles.contains(Role.ResourceManager));\r
                assertFalse(roles.contains(Role.Admin));\r
-               \r
+\r
                testUser.removeRole(Role.Admin);\r
                roles = testUser.getRoles();\r
                assertFalse(roles.contains(Role.User));\r
                assertTrue(roles.contains(Role.ResourceManager));\r
                assertFalse(roles.contains(Role.Admin));\r
        }\r
-       \r
+\r
        @Test\r
-       public void cloneTest() throws Exception{\r
+       public void cloneTest() throws Exception {\r
                User testUser = new User("TestUser", "pass");\r
                User clonedUser = testUser.clone();\r
                assertEquals(testUser.getUserName(), clonedUser.getUserName());\r