DataHandlerForTest Fehlerbehebungen
authorMatthias <balmm1@bfh.ch>
Wed, 25 Nov 2015 11:27:40 +0000 (12:27 +0100)
committerMatthias <balmm1@bfh.ch>
Wed, 25 Nov 2015 11:27:40 +0000 (12:27 +0100)
src/main/java/ch/bfh/ti/srs/datahandler/DataHandlerForTests.java

index 771f67e..f8939da 100644 (file)
@@ -80,7 +80,7 @@ public class DataHandlerForTests implements DataHandler {
                        return false;
                }
                else{
-                       for (Reservation res : reservationList) {
+                       for (Resource res : resourceList) {
                                if (res.getId() == resource.getId()){
                                        return false;
                                }
@@ -167,7 +167,7 @@ public class DataHandlerForTests implements DataHandler {
                if (reservation == null){
                        throw new IllegalArgumentException("Reservation object must not be null!");
                }
-               else if(resourceList.contains(reservation)) {
+               else if(reservationList.contains(reservation)) {
                        return false;
                }
                else{
@@ -202,12 +202,10 @@ public class DataHandlerForTests implements DataHandler {
                if (reservation == null){
                        throw new IllegalArgumentException("Reservation object must not be null!");
                }
-               for (Reservation res : reservationList) {
-                       if (res.getId() == (reservation.getId())){
-                               reservationList.remove(res);
-                               reservationList.add(reservation);
-                               return true;
-                       }
+               if(findReservation(reservation.getId()) != null){
+                       reservationList.remove(findReservation(reservation.getId()));
+                       reservationList.add(reservation);
+                       return true;
                }
                return false;
        }
@@ -217,8 +215,8 @@ public class DataHandlerForTests implements DataHandler {
                if (reservation == null){
                        throw new IllegalArgumentException("Reservation object must not be null!");
                }
-               else if(resourceList.contains(reservation)) {
-                       resourceList.remove(reservation);
+               else if(reservationList.contains(reservation)) {
+                       reservationList.remove(reservation);
                        return true;
                }
                else{