From abc4c39c933a040dfeea53df9fe84f4542b6180f Mon Sep 17 00:00:00 2001
From: Andre Hartig <andre.hartig@student.reutlingen-university.de>
Date: Sat, 29 Jun 2024 11:27:00 +0200
Subject: [PATCH] added comments and tests.

---
 opp/core/src/main/java/OPStaff.java           |  24 +-
 opp/core/src/main/java/OPStaffService.java    |   5 +-
 .../src/main/java/OPStaffServiceImpl.java     |  46 +-
 opp/core/src/main/java/Operation.java         |   2 +-
 opp/core/src/main/java/OperationService.java  |   2 +-
 .../src/main/java/OperationServiceImpl.java   |  15 +-
 opp/core/src/main/java/OperationTeam.java     |  32 +-
 .../src/main/java/OperationTeamService.java   |  19 +-
 ...mpl.java => OperationTeamServiceImpl.java} |  99 ++--
 opp/core/src/main/java/Patient.java           |   4 +
 opp/core/src/main/java/PreparationNote.java   |  38 +-
 .../src/main/java/PreparationNoteService.java |  14 +-
 ...l.java => PreparationNoteServiceImpl.java} |  47 +-
 opp/core/src/main/java/Role.java              |   3 +
 opp/core/src/main/java/Room.java              |  30 +-
 opp/core/src/main/java/RoomService.java       |  13 +-
 opp/core/src/main/java/RoomServiceImpl.java   |  24 +-
 opp/core/src/main/java/Specialty.java         |   3 +
 .../src/main/java/JDBCRepository.java         |  24 +-
 opp/jdbc-repo-impl/src/test/java/Tests.java   | 456 ++++--------------
 20 files changed, 399 insertions(+), 501 deletions(-)
 rename opp/core/src/main/java/{OperationTeamImpl.java => OperationTeamServiceImpl.java} (60%)
 rename opp/core/src/main/java/{PreparationNoteImpl.java => PreparationNoteServiceImpl.java} (54%)

diff --git a/opp/core/src/main/java/OPStaff.java b/opp/core/src/main/java/OPStaff.java
index e0c45fb..ed55cf2 100644
--- a/opp/core/src/main/java/OPStaff.java
+++ b/opp/core/src/main/java/OPStaff.java
@@ -3,6 +3,13 @@ import java.time.LocalDate;
 import java.time.LocalTime;
 import java.util.Optional;
 
+/**
+ * OPStaff class with its attributes, filters and commands.
+ * @param id unique id of the op staff
+ * @param role the role of the op staff
+ * @param specialty the specialty of the op staff
+ * @param lastUpdate the last time this object was changed
+ */
 public record OPStaff(
         Id<OPStaff> id,
         Role role,
@@ -16,23 +23,32 @@ public record OPStaff(
     public sealed interface Command permits Create, Delete, Update { }
 
     /**
-     * Create command to create a new Operation
-     * @param role if the Personal is a surgeon or an assistant
-     * @param specialty the hospital specialties
+     * Create command to create a new op staff
+     * @param role the role of the op staff
+     * @param specialty the specialty of the op staff
      */
     public record Create(
             Role role,
             Specialty specialty
     ) implements Command {}
 
+    /**
+     * Update command to update an existing op staff
+     * @param id the id of the existing op staff
+     * @param role optional new role
+     * @param specialty optional new specialty
+     */
     public record Update(
             Id<OPStaff> id,
             Optional<Role> role,
             Optional<Specialty> specialty
     ) implements Command {}
 
+    /**
+     * Delete command to delete an existing op staff
+     * @param id the id of the existing op staff
+     */
     public record Delete(
             Id<OPStaff> id
     ) implements Command {}
-
 }
diff --git a/opp/core/src/main/java/OPStaffService.java b/opp/core/src/main/java/OPStaffService.java
index aaed926..303b9e2 100644
--- a/opp/core/src/main/java/OPStaffService.java
+++ b/opp/core/src/main/java/OPStaffService.java
@@ -11,7 +11,7 @@ public interface OPStaffService {
      * @param cmd the command to process
      * @return the processed OPStaff
      */
-    OPStaff process(OPStaff.Command cmd) throws Exception;
+    OPStaff process(OPStaff.Command cmd);
 
     /**
      * Gets the Operation by ID
@@ -19,7 +19,4 @@ public interface OPStaffService {
      * @return the OPStaff
      */
     Optional<OPStaff> getOPStaff(Id<OPStaff> id);
-
-    //List<OPStaff> getAllOPStaffs();
-
 }
\ No newline at end of file
diff --git a/opp/core/src/main/java/OPStaffServiceImpl.java b/opp/core/src/main/java/OPStaffServiceImpl.java
index bfe6b15..1ad83c4 100644
--- a/opp/core/src/main/java/OPStaffServiceImpl.java
+++ b/opp/core/src/main/java/OPStaffServiceImpl.java
@@ -6,12 +6,16 @@ public class OPStaffServiceImpl implements OPStaffService{
 
     private final Repository repo;
 
+    /**
+     * Initializes the repository to operate the services
+     * @param repo the repository to work with
+     */
     public OPStaffServiceImpl(Repository repo) {
         this.repo = repo;
     }
 
     @Override
-    public OPStaff process(OPStaff.Command cmd) throws Exception {
+    public OPStaff process(OPStaff.Command cmd) {
         return switch (cmd){
             case OPStaff.Create cr -> create(cr);
             case OPStaff.Update up -> update(up);
@@ -19,7 +23,17 @@ public class OPStaffServiceImpl implements OPStaffService{
         };
     }
 
-    public OPStaff create(OPStaff.Create cr) throws Exception {
+    @Override
+    public Optional<OPStaff> getOPStaff(Id<OPStaff> id) {
+        return repo.findOPStaff(id);
+    }
+
+    /**
+     * Creates a new op staff with the set parameters
+     * @param cr the create command that includes the parameters to create the op staff with
+     * @return the created op staff
+     */
+    public OPStaff create(OPStaff.Create cr) {
         OPStaff opStaff =
                 new OPStaff(
                         repo.opStaffId(),
@@ -32,7 +46,12 @@ public class OPStaffServiceImpl implements OPStaffService{
         return opStaff;
     }
 
-    public OPStaff update(OPStaff.Update up) throws Exception{
+    /**
+     * Updates an existing op staff with the set parameters
+     * @param up the update command that includes the parameters to update the op staff with
+     * @return the updated op staff
+     */
+    public OPStaff update(OPStaff.Update up) {
 
         Optional<OPStaff> foundOPStaff =  repo.findOPStaff(up.id());
 
@@ -53,7 +72,12 @@ public class OPStaffServiceImpl implements OPStaffService{
         return opStaff;
     }
 
-    public OPStaff delete(OPStaff.Delete del) throws Exception{
+    /**
+     * Deletes an existing op staff with the given id
+     * @param del the delete command that includes the id to delete the op staff with
+     * @return the deleted op staff
+     */
+    public OPStaff delete(OPStaff.Delete del) {
 
         Optional<OPStaff> foundOPStaff = repo.findOPStaff(del.id());
 
@@ -66,18 +90,4 @@ public class OPStaffServiceImpl implements OPStaffService{
 
         return null;
     }
-
-    @Override
-    public Optional<OPStaff> getOPStaff(Id<OPStaff> id) {
-        return repo.findOPStaff(id);
-    }
-
-    /*
-    @Override
-    public List<OPStaff> getAllOPStaffs(){
-        return repo.findAllOPStaffs();
-    }
-     */
-
-
 }
diff --git a/opp/core/src/main/java/Operation.java b/opp/core/src/main/java/Operation.java
index acfca8a..357b9b5 100644
--- a/opp/core/src/main/java/Operation.java
+++ b/opp/core/src/main/java/Operation.java
@@ -62,7 +62,7 @@ public record Operation(
     ) implements Command {}
 
     /**
-     * Create command to update an already existing operation.
+     * Update command to update an already existing operation.
      * @param id the id of the already existing operation
      * @param date optional new date
      * @param startTime optional new start time
diff --git a/opp/core/src/main/java/OperationService.java b/opp/core/src/main/java/OperationService.java
index ef8949a..ab6ae00 100644
--- a/opp/core/src/main/java/OperationService.java
+++ b/opp/core/src/main/java/OperationService.java
@@ -11,7 +11,7 @@ public interface OperationService {
      * @param cmd the command to process
      * @return the processed operation
      */
-    Operation process(Operation.Command cmd) throws Exception;
+    Operation process(Operation.Command cmd);
 
     /**
      * Gets the operation by id
diff --git a/opp/core/src/main/java/OperationServiceImpl.java b/opp/core/src/main/java/OperationServiceImpl.java
index f76cf90..a347326 100644
--- a/opp/core/src/main/java/OperationServiceImpl.java
+++ b/opp/core/src/main/java/OperationServiceImpl.java
@@ -3,7 +3,7 @@ import java.util.List;
 import java.util.Optional;
 
 /**
- * The implemented Services of the Operations
+ * The implemented Services of the Operation
  */
 public class OperationServiceImpl implements OperationService {
 
@@ -18,7 +18,7 @@ public class OperationServiceImpl implements OperationService {
     }
 
     @Override
-    public Operation process(Operation.Command cmd) throws Exception {
+    public Operation process(Operation.Command cmd) {
         return switch (cmd){
             case Operation.Create cr -> create(cr);
             case Operation.Update up -> update(up);
@@ -40,9 +40,8 @@ public class OperationServiceImpl implements OperationService {
      * Creates a new operation with the set parameters
      * @param cr the create command that includes the parameters to create the operation with
      * @return the created operation
-     * @throws Exception if the save in the repository failed
      */
-    public Operation create(Operation.Create cr) throws Exception {
+    public Operation create(Operation.Create cr) {
         Operation operation =
                 new Operation(
                         repo.operationId(),
@@ -63,9 +62,8 @@ public class OperationServiceImpl implements OperationService {
      * Updates an existing operation with the set parameters
      * @param up the update command that includes the parameters to update the operation with
      * @return the updated operation
-     * @throws Exception if the update in the repository failed
      */
-    public Operation update(Operation.Update up) throws Exception {
+    public Operation update(Operation.Update up) {
 
         Optional<Operation> foundOperation =  repo.findOperation(up.id());
 
@@ -94,15 +92,14 @@ public class OperationServiceImpl implements OperationService {
      * Deletes an existing operation with the given id
      * @param del the delete command that includes the id to delete the operation with
      * @return the deleted operation
-     * @throws Exception if delete in the repository failed
      */
-    public Operation delete(Operation.Delete del) throws Exception {
+    public Operation delete(Operation.Delete del) {
 
         Optional<Operation> foundOperation =  repo.findOperation(del.id());
         if (foundOperation.isPresent()) {
             List<PreparationNote> allPreparationNotes = repo.findAllPreparationNotes();
             for (PreparationNote preparationNote : allPreparationNotes) {
-                if (preparationNote.operationsId().value().equals(foundOperation.get().id().value())) {
+                if (preparationNote.operationId().value().equals(foundOperation.get().id().value())) {
                     repo.deletePreparationNote(preparationNote.id());
                 }
             }
diff --git a/opp/core/src/main/java/OperationTeam.java b/opp/core/src/main/java/OperationTeam.java
index 090adc5..b2835bc 100644
--- a/opp/core/src/main/java/OperationTeam.java
+++ b/opp/core/src/main/java/OperationTeam.java
@@ -1,6 +1,13 @@
 import java.time.Instant;
 import java.util.List;
 
+/**
+ * OperationTeam class with its attributes, filters and commands.
+ * @param id unique id of the operation team
+ * @param opStaffs the list of all op staffs in this team
+ * @param teamName the name of the team
+ * @param lastUpdate the last time this object was changed
+ */
 public record OperationTeam(
         Id<OperationTeam> id,
         List<OPStaff> opStaffs,
@@ -8,6 +15,9 @@ public record OperationTeam(
         Instant lastUpdate
 ) {
 
+    /**
+     * Operation commands
+     */
     public sealed interface Command permits
             Create,
             Delete,
@@ -15,23 +25,41 @@ public record OperationTeam(
             RemoveStaff
     {}
 
+    /**
+     * Create command to create a new operation team
+     * @param teamName the name of the new operation team
+     * @param opStaffs the list of all op staffs in the new operation team
+     */
     public record Create(
             String teamName,
             List<OPStaff> opStaffs
     ) implements Command {}
 
+    /**
+     * Command to delete an existing operation team
+     * @param id the id of the already existing operation team
+     */
     public record Delete(
-            Id<OperationTeam> operationTeamId
+            Id<OperationTeam> id
     ) implements Command {}
 
+    /**
+     * Command to assign an op staff to an operation team
+     * @param operationTeamId the id of the already existing operation team
+     * @param opStaffId the id of the already existing op staff
+     */
     public record AssignStaff(
             Id<OperationTeam> operationTeamId,
             Id<OPStaff> opStaffId
     ) implements Command {}
 
+    /**
+     * Command to remove an op staff from an operation team
+     * @param operationTeamId the id of the already existing operation team
+     * @param opStaffId the id of the assigned op staff
+     */
     public record RemoveStaff(
             Id<OperationTeam> operationTeamId,
             Id<OPStaff> opStaffId
     ) implements Command {}
-
 }
diff --git a/opp/core/src/main/java/OperationTeamService.java b/opp/core/src/main/java/OperationTeamService.java
index 171ab4d..22efe78 100644
--- a/opp/core/src/main/java/OperationTeamService.java
+++ b/opp/core/src/main/java/OperationTeamService.java
@@ -1,13 +1,18 @@
-import java.sql.SQLException;
-import java.util.List;
 import java.util.Optional;
 
 public interface OperationTeamService {
 
-    public OperationTeam process(OperationTeam.Command cmd) throws Exception;
-
-    public Optional<OperationTeam> getOperationTeam(Id<OperationTeam> operationTeamId) throws SQLException;
-
-    //public List<OperationTeam> getAllOperationTeams() throws SQLException;
+    /**
+     * Processes the possible commands for an operation team
+     * @param cmd the command to process
+     * @return the processed operation team
+     */
+    OperationTeam process(OperationTeam.Command cmd);
 
+    /**
+     * Gets the operation  team by id
+     * @param id the id of the operation team
+     * @return the operation team
+     */
+    Optional<OperationTeam> getOperationTeam(Id<OperationTeam> id);
 }
diff --git a/opp/core/src/main/java/OperationTeamImpl.java b/opp/core/src/main/java/OperationTeamServiceImpl.java
similarity index 60%
rename from opp/core/src/main/java/OperationTeamImpl.java
rename to opp/core/src/main/java/OperationTeamServiceImpl.java
index dbec376..768e1ed 100644
--- a/opp/core/src/main/java/OperationTeamImpl.java
+++ b/opp/core/src/main/java/OperationTeamServiceImpl.java
@@ -1,20 +1,23 @@
-import java.sql.SQLException;
 import java.time.Instant;
-import java.util.ArrayList;
-import java.util.List;
 import java.util.Optional;
 
-public class OperationTeamImpl implements OperationTeamService{
+/**
+ * The implemented Services of the OperationTeam
+ */
+public class OperationTeamServiceImpl implements OperationTeamService{
 
     private final Repository repo;
 
-    public OperationTeamImpl(Repository repo) {
+    /**
+     * Initializes the repository to operate the services
+     * @param repo the repository to work with
+     */
+    public OperationTeamServiceImpl(Repository repo) {
         this.repo = repo;
     }
 
-
     @Override
-    public OperationTeam process(OperationTeam.Command cmd) throws Exception {
+    public OperationTeam process(OperationTeam.Command cmd) {
         return switch(cmd){
             case OperationTeam.Create cr -> create(cr);
             case OperationTeam.Delete del -> delete(del);
@@ -23,26 +26,18 @@ public class OperationTeamImpl implements OperationTeamService{
         };
     }
 
-    private OperationTeam delete(OperationTeam.Delete del) {
-
-        Optional<OperationTeam> foundOperationTeam = repo.findOperationTeam(del.operationTeamId());
-
-        if(foundOperationTeam.isPresent()) {
-
-            if (!foundOperationTeam.get().opStaffs().isEmpty()) {
-                for (OPStaff opStaff : foundOperationTeam.get().opStaffs()) {
-                    repo.removeOPStaffInOperationTeam(del.operationTeamId(), opStaff.id());
-                }
-                return repo.deleteOperationTeam(del.operationTeamId());
-            }
-            return foundOperationTeam.get();
-        }
-        return null;
+    @Override
+    public Optional<OperationTeam> getOperationTeam(Id<OperationTeam> operationTeamId) {
+        return repo.findOperationTeam(operationTeamId);
     }
 
-    //Only creates a connection between the newly created operationTeam and the already existing opStaffs.
-    //Does not save the opStaffs included in operationTeam to database.
-    private OperationTeam create(OperationTeam.Create cr) throws Exception {
+    /**
+     * Creates a new operation team with the set parameters.
+     * Assigns the op staffs in the parameters to the operation team
+     * @param cr the create command that includes the parameters to create the operation team with
+     * @return the created operation team
+     */
+    private OperationTeam create(OperationTeam.Create cr) {
 
         Id<OperationTeam> generatedOperationTeamId = repo.operationTeamId();
         OperationTeam operationTeam = new OperationTeam(
@@ -61,23 +56,54 @@ public class OperationTeamImpl implements OperationTeamService{
         return operationTeam;
     }
 
-    private OperationTeam assignStaff(OperationTeam.AssignStaff as) throws Exception {
+    /**
+     * Deletes an existing operation team with the given id.
+     * Removes the op staffs from the operation team
+     * @param del the delete command that includes the id to delete the operation team with
+     * @return the deleted operation team
+     */
+    private OperationTeam delete(OperationTeam.Delete del) {
+
+        Optional<OperationTeam> foundOperationTeam = repo.findOperationTeam(del.id());
+
+        if(foundOperationTeam.isPresent()) {
+
+            if (!foundOperationTeam.get().opStaffs().isEmpty()) {
+                for (OPStaff opStaff : foundOperationTeam.get().opStaffs()) {
+                    repo.removeOPStaffInOperationTeam(del.id(), opStaff.id());
+                }
+                return repo.deleteOperationTeam(del.id());
+            }
+            return foundOperationTeam.get();
+        }
+        return null;
+    }
+
+    /**
+     * Assigns the op staff to the operation team
+     * @param as the assignStaff command that includes the ids of the op staff and operation team
+     * @return the operation team with the assigned staff
+     */
+    private OperationTeam assignStaff(OperationTeam.AssignStaff as) {
 
         OPStaff opStaffToAssign = repo.findOPStaff(as.opStaffId()).get();
 
         OperationTeam operationTeamToAssignStaff = repo.findOperationTeam(as.operationTeamId()).get();
 
-        // Add Staff to OperationTeam Object and save it into database
         if(repo.assignOPStaffToOperationTeam(as.operationTeamId(), as.opStaffId())) {
             operationTeamToAssignStaff.opStaffs().add(opStaffToAssign);
-            //repo.save(operationTeamToAssignStaff);
             return operationTeamToAssignStaff;
         } else {
             return null;
         }
     }
 
-    private OperationTeam removeStaff(OperationTeam.RemoveStaff rs) throws Exception {
+    /**
+     * Removes the op staff from the operation team
+     * @param rs the removeStaff command that includes the ids of the op staff and operation team
+     * @return the operation team with the removed staff
+     */
+    private OperationTeam removeStaff(OperationTeam.RemoveStaff rs) {
 
         Optional<OperationTeam> findOperationTeam = repo.findOperationTeam(rs.operationTeamId());
 
@@ -89,19 +115,4 @@ public class OperationTeamImpl implements OperationTeamService{
         }
         return null;
     }
-
-    /*
-    @Override
-    public List<OperationTeam> getAllOperationTeams() throws SQLException {
-
-        return repo.findOperationTeams();
-    }
-     */
-
-
-    @Override
-    public Optional<OperationTeam> getOperationTeam(Id<OperationTeam> operationTeamId) throws SQLException {
-        return repo.findOperationTeam(operationTeamId);
-    }
-
 }
diff --git a/opp/core/src/main/java/Patient.java b/opp/core/src/main/java/Patient.java
index 50b70ff..9dda729 100644
--- a/opp/core/src/main/java/Patient.java
+++ b/opp/core/src/main/java/Patient.java
@@ -1,3 +1,7 @@
+/**
+ * A class used to simulate an existing Patient.
+ * @param id unique id of the patient
+ */
 public record Patient (
         Id<Patient> id
 ) {
diff --git a/opp/core/src/main/java/PreparationNote.java b/opp/core/src/main/java/PreparationNote.java
index 25bf198..205c431 100644
--- a/opp/core/src/main/java/PreparationNote.java
+++ b/opp/core/src/main/java/PreparationNote.java
@@ -3,27 +3,51 @@ import java.time.LocalDate;
 import java.time.LocalTime;
 import java.util.Optional;
 
+/**
+ * PreparationNote class with its attributes, filters and commands.
+ * @param id unique id of the preparation note
+ * @param note the text of the preparation note
+ * @param operationId the id of the operation it is assigned to
+ * @param lastUpdate the last time this object was changed
+ */
 public record PreparationNote (
 
     Id<PreparationNote> id,
     String note,
-    Id<Operation> operationsId,
+    Id<Operation> operationId,
     Instant lastUpdate
 ) {
 
-    public static sealed interface Command permits Create, Update, Delete { }
-
-    public static record Create(
+    /**
+     * PreparationNote commands
+     */
+    public sealed interface Command permits Create, Update, Delete { }
+
+    /**
+     * Create command to create a new preparation note
+     * @param note the text
+     * @param operationId the operation id
+     */
+    public record Create(
             String note,
-            Id<Operation> operationsId
+            Id<Operation> operationId
     ) implements Command {}
 
-    public static record Update(
+    /**
+     * Update command to update an existing preparation note
+     * @param id the id of the existing preparation note
+     * @param note the new text
+     */
+    public record Update(
             Id<PreparationNote> id,
             String note
     ) implements Command {}
 
-    public static record Delete(
+    /**
+     * Delete command to delete an existing preparation note
+     * @param id the id of the existing preparation note
+     */
+    public record Delete(
             Id<PreparationNote> id
     ) implements Command {}
 
diff --git a/opp/core/src/main/java/PreparationNoteService.java b/opp/core/src/main/java/PreparationNoteService.java
index d2f230e..384f33d 100644
--- a/opp/core/src/main/java/PreparationNoteService.java
+++ b/opp/core/src/main/java/PreparationNoteService.java
@@ -2,7 +2,17 @@ import java.util.Optional;
 
 public interface PreparationNoteService {
 
-    PreparationNote process(PreparationNote.Command cmd) throws Exception;
+    /**
+     * Processes the possible commands for a preparation note
+     * @param cmd the command to process
+     * @return the processed preparation note
+     */
+    PreparationNote process(PreparationNote.Command cmd);
 
-    Optional<PreparationNote> findPreparationNote(Id<PreparationNote> id);
+    /**
+     * Gets the preparation note by ID
+     * @param id the ID of the preparation note
+     * @return the preparation note
+     */
+    Optional<PreparationNote> getPreparationNote(Id<PreparationNote> id);
 }
diff --git a/opp/core/src/main/java/PreparationNoteImpl.java b/opp/core/src/main/java/PreparationNoteServiceImpl.java
similarity index 54%
rename from opp/core/src/main/java/PreparationNoteImpl.java
rename to opp/core/src/main/java/PreparationNoteServiceImpl.java
index 2b40100..ab93749 100644
--- a/opp/core/src/main/java/PreparationNoteImpl.java
+++ b/opp/core/src/main/java/PreparationNoteServiceImpl.java
@@ -1,16 +1,20 @@
 import java.time.Instant;
 import java.util.Optional;
 
-public class PreparationNoteImpl implements PreparationNoteService {
+public class PreparationNoteServiceImpl implements PreparationNoteService {
 
     private final Repository repo;
 
-    public PreparationNoteImpl(Repository repo) {
+    /**
+     * Initializes the repository to operate the services
+     * @param repo the repository to work with
+     */
+    public PreparationNoteServiceImpl(Repository repo) {
         this.repo = repo;
     }
 
     @Override
-    public PreparationNote process(PreparationNote.Command cmd) throws Exception {
+    public PreparationNote process(PreparationNote.Command cmd) {
         return switch (cmd){
             case PreparationNote.Create cr -> create(cr);
             case PreparationNote.Update up -> update(up);
@@ -18,12 +22,22 @@ public class PreparationNoteImpl implements PreparationNoteService {
         };
     }
 
-    public PreparationNote create(PreparationNote.Create cr) throws Exception {
+    @Override
+    public Optional<PreparationNote> getPreparationNote(Id<PreparationNote> id){
+        return repo.findPreparationNote(id);
+    }
+
+    /**
+     * Creates a new preparation note with the set parameters
+     * @param cr the create command that includes the parameters to create the preparation note with
+     * @return the created preparation note
+     */
+    public PreparationNote create(PreparationNote.Create cr) {
         PreparationNote preparationNote =
                 new PreparationNote(
                         repo.preparationNoteId(),
                         cr.note(),
-                        cr.operationsId(),
+                        cr.operationId(),
                         Instant.now());
 
         repo.save(preparationNote);
@@ -31,7 +45,12 @@ public class PreparationNoteImpl implements PreparationNoteService {
         return preparationNote;
     }
 
-    public PreparationNote update(PreparationNote.Update up) throws Exception {
+    /**
+     * Updates an existing preparation note with the set parameters
+     * @param up the update command that includes the parameters to update the preparation note with
+     * @return the updated preparation note
+     */
+    public PreparationNote update(PreparationNote.Update up) {
 
         Optional<PreparationNote> foundPreparationNote =  repo.findPreparationNote(up.id());
 
@@ -43,7 +62,7 @@ public class PreparationNoteImpl implements PreparationNoteService {
                     new PreparationNote(
                             currentPreparationNote.id(),
                             up.note(),
-                            currentPreparationNote.operationsId(),
+                            currentPreparationNote.operationId(),
                             Instant.now());
 
             repo.save(preparationNote);
@@ -52,7 +71,12 @@ public class PreparationNoteImpl implements PreparationNoteService {
         return preparationNote;
     }
 
-    private PreparationNote delete(PreparationNote.Delete del) throws Exception {
+    /**
+     * Deletes an existing preparation note with the given id
+     * @param del the delete command that includes the id to delete the preparation note with
+     * @return the deleted preparation note
+     */
+    private PreparationNote delete(PreparationNote.Delete del) {
 
         Optional<PreparationNote> returnedPreparationNote = repo.findPreparationNote(del.id());
 
@@ -61,11 +85,4 @@ public class PreparationNoteImpl implements PreparationNoteService {
         }
         return null;
     }
-
-    public Optional<PreparationNote> findPreparationNote(Id<PreparationNote> id){
-        return repo.findPreparationNote(id);
-    }
-
-
-
 }
diff --git a/opp/core/src/main/java/Role.java b/opp/core/src/main/java/Role.java
index a18e09d..30b1e4d 100644
--- a/opp/core/src/main/java/Role.java
+++ b/opp/core/src/main/java/Role.java
@@ -1,3 +1,6 @@
+/**
+ * An Enum that contains all possible roles for an OPStaff
+ */
 public enum Role {
     SURGEON,
     ASSISTANT
diff --git a/opp/core/src/main/java/Room.java b/opp/core/src/main/java/Room.java
index 84df184..1e42c35 100644
--- a/opp/core/src/main/java/Room.java
+++ b/opp/core/src/main/java/Room.java
@@ -1,27 +1,49 @@
 import java.time.Instant;
 
+/**
+ * Room class with its attributes, filters and commands.
+ * @param id unique id of the room
+ * @param roomName the name of the room
+ * @param lastUpdate the last time this object was changed
+ */
 public record Room (
     Id<Room> id,
     String roomName,
     Instant lastUpdate
 ) {
 
-    public static sealed interface Command permits
+    /**
+     * Room commands
+     */
+    public sealed interface Command permits
             Create,
             Update,
             Delete
     {}
 
-    public static record Create(
+    /**
+     * Command to create a new room
+     * @param roomName the name of the new room
+     */
+    public record Create(
             String roomName
     ) implements Command {}
 
-    public static record Update(
+    /**
+     * Command to update an existing room
+     * @param id the id of the existing room
+     * @param roomName the new room name
+     */
+    public record Update(
             Id<Room> id,
             String roomName
     ) implements Command{}
 
-    public static record Delete(
+    /**
+     * Command to delete an existing room
+     * @param id the id of the room to delete
+     */
+    public record Delete(
             Id<Room> id
     ) implements Command{}
 
diff --git a/opp/core/src/main/java/RoomService.java b/opp/core/src/main/java/RoomService.java
index 9d6b01f..29b0d75 100644
--- a/opp/core/src/main/java/RoomService.java
+++ b/opp/core/src/main/java/RoomService.java
@@ -1,8 +1,19 @@
 import java.util.Optional;
 
+
 public interface RoomService {
 
+    /**
+     * Processes the possible commands for a room
+     * @param cmd the command to process
+     * @return the processed room
+     */
     Room process(Room.Command cmd) throws Exception;
 
-    Optional<Room> findRoom(Id<Room> id);
+    /**
+     * Gets the room by ID
+     * @param id the ID of the room
+     * @return the room
+     */
+    Optional<Room> getRoom(Id<Room> id);
 }
diff --git a/opp/core/src/main/java/RoomServiceImpl.java b/opp/core/src/main/java/RoomServiceImpl.java
index 8c92789..f9fa0e9 100644
--- a/opp/core/src/main/java/RoomServiceImpl.java
+++ b/opp/core/src/main/java/RoomServiceImpl.java
@@ -18,6 +18,16 @@ public class RoomServiceImpl implements RoomService {
         };
     }
 
+    @Override
+    public Optional<Room> getRoom(Id<Room> id){
+        return repo.findRoom(id);
+    }
+
+    /**
+     * Creates a new room with the set parameters
+     * @param cr the create command that includes the parameters to create the room with
+     * @return the created room
+     */
     public Room create(Room.Create cr) throws Exception {
         Room room = new Room(
                 repo.roomId(),
@@ -29,10 +39,11 @@ public class RoomServiceImpl implements RoomService {
         return room;
     }
 
-    public Optional<Room> findRoom(Id<Room> id){
-        return repo.findRoom(id);
-    }
-
+    /**
+     * Updates an existing room with the set parameters
+     * @param up the update command that includes the parameters to update the room with
+     * @return the updated room
+     */
     public Room update(Room.Update up) throws Exception {
 
         Optional<Room> foundRoom = repo.findRoom(up.id());
@@ -52,6 +63,11 @@ public class RoomServiceImpl implements RoomService {
         return room;
     }
 
+    /**
+     * Deletes an existing room with the given id
+     * @param del the delete command that includes the id to delete the room with
+     * @return the deleted room
+     */
     private Room delete(Room.Delete del) throws Exception {
 
         Optional<Room> returnedRoom = repo.findRoom(del.id());
diff --git a/opp/core/src/main/java/Specialty.java b/opp/core/src/main/java/Specialty.java
index 62c9515..a412b01 100644
--- a/opp/core/src/main/java/Specialty.java
+++ b/opp/core/src/main/java/Specialty.java
@@ -1,3 +1,6 @@
+/**
+ * An Enum containing all possible specialities for an OPStaff
+ */
 public enum Specialty {
     ORTHOPEDICS,
     CARDIOLOGY,
diff --git a/opp/jdbc-repo-impl/src/main/java/JDBCRepository.java b/opp/jdbc-repo-impl/src/main/java/JDBCRepository.java
index d2ac4b3..99bd8f0 100644
--- a/opp/jdbc-repo-impl/src/main/java/JDBCRepository.java
+++ b/opp/jdbc-repo-impl/src/main/java/JDBCRepository.java
@@ -305,7 +305,7 @@ class JDBCRepository implements Repository
                     ") VALUES (" +
                     sqlValue(preparationNote.id().value()) + "," +
                     sqlValue(preparationNote.note()) + "," +
-                    sqlValue(preparationNote.operationsId()) + "," +
+                    sqlValue(preparationNote.operationId()) + "," +
                     sqlValue(preparationNote.lastUpdate()) +
                     ");";
   }
@@ -673,28 +673,6 @@ class JDBCRepository implements Repository
     }
   }
 
-  /*
-  @Override
-  public List<OperationTeam> findOperationTeams() {
-    try(
-            var result =
-                    conn.createStatement()
-                            .executeQuery("SELECT * FROM operationTeams;")
-    ) {
-      var operationTeams = new ArrayList<OperationTeam>();
-
-      while (result.next()) {
-        operationTeams.add(readOperationTeamFromRow(result));
-      }
-      return operationTeams;
-
-    }catch(SQLException e){
-      throw new RuntimeException(e);
-    }
-
-  }
-   */
-
   @Override
   public OperationTeam deleteOperationTeam(Id<OperationTeam> id) {
 
diff --git a/opp/jdbc-repo-impl/src/test/java/Tests.java b/opp/jdbc-repo-impl/src/test/java/Tests.java
index 7d3842b..daa0b13 100644
--- a/opp/jdbc-repo-impl/src/test/java/Tests.java
+++ b/opp/jdbc-repo-impl/src/test/java/Tests.java
@@ -1,14 +1,11 @@
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
-import java.sql.SQLException;
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.LocalTime;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Objects;
 import java.util.Optional;
 
 import static org.junit.Assert.*;
@@ -43,12 +40,13 @@ public final class Tests
 
   private static PreparationNoteService preparationNoteService;
 
-  private static Room testRoom = null;
+  private static Room testRoom1 = null;
+  private static Room testRoom2 = null;
 
   private static RoomService roomService;
 
   @BeforeClass
-  public static void init() throws Exception {
+  public static void init() {
 
     System.setProperty("opp.repo.jdbc.url",      "jdbc:postgresql:postgres");
     System.setProperty("opp.repo.jdbc.user",     "postgres");
@@ -91,7 +89,7 @@ public final class Tests
     );
 
     List<OPStaff> opStaffList2 = new ArrayList<>();
-    opStaffList1.add(testOPStaff3);
+    opStaffList2.add(testOPStaff3);
 
     testOperationTeam2 = new OperationTeam(
             new Id<>("operationTeam2222"),
@@ -100,12 +98,18 @@ public final class Tests
             Instant.now()
     );
 
-    testRoom = new Room(
+    testRoom1 = new Room(
             new Id<>("room1111"),
             ("Room1"),
             Instant.now()
     );
 
+    testRoom2 = new Room(
+            new Id<>("room2222"),
+            ("Room2"),
+            Instant.now()
+    );
+
     testOperation = new Operation(
             new Id<>("operation1111"),
             LocalDate.of(2024, 5, 24),
@@ -113,7 +117,7 @@ public final class Tests
             LocalTime.of(14, 0, 0),
             testPatient.id(),
             testOperationTeam1.id(),
-            testRoom.id(),
+            testRoom1.id(),
             Instant.now()
     );
 
@@ -135,93 +139,18 @@ public final class Tests
 
     opStaffService = new OPStaffServiceImpl(repo);
 
-    operationTeamService = new OperationTeamImpl(repo);
+    operationTeamService = new OperationTeamServiceImpl(repo);
 
-    preparationNoteService = new PreparationNoteImpl(repo);
+    preparationNoteService = new PreparationNoteServiceImpl(repo);
 
     roomService = new RoomServiceImpl(repo);
 
   }
 
-  @Ignore
-  @Test
-  public void testRepoOperationSave(){
-
-    try {
-      repo.save(testPreparationNote1);
-      repo.save(testRoom);
-      repo.save(testOperationTeam1);
-      repo.save(testOperation);
-    } catch (Exception e){
-      e.printStackTrace();
-    }
-
-    assertTrue(
-            repo.findOperation(testOperation.id()).isPresent()
-    );
-  }
-
-  @Ignore
   @Test
-  public void testRepoOperationUpdate() throws Exception {
-
-    try {
-      repo.save(testPreparationNote1);
-      repo.save(testRoom);
-      repo.save(testOperationTeam1);
-      repo.save(testOperation);
-    } catch (Exception e){
-      e.printStackTrace();
-    }
-
-    Operation updatedTestOperation = new Operation(
-            testOperation.id(),
-            LocalDate.of(1999, 1, 1),
-            testOperation.startTime(),
-            testOperation.endTime(),
-            testOperation.patientId(),
-            testOperation.operationTeamId(),
-            testOperation.roomId(),
-            Instant.now()
-    );
-
-    try {
-      repo.save(updatedTestOperation);
-    } catch (Exception e){
-      e.printStackTrace();
-    }
-
-    Optional<Operation> readOperation = repo.findOperation(updatedTestOperation.id());
-    if (readOperation.isPresent()) {
-      assertNotEquals(readOperation.get().date(), testOperation.date());
-      assertNotEquals(readOperation.get().lastUpdate(), testOperation.lastUpdate());
-    } else {
-      throw new Exception();
-    }
-  }
+  public void testCreateOperation() {
 
-  @Ignore
-  @Test
-  public void testRepoOperationDelete() {
-    try {
-      repo.save(testPreparationNote1);
-      repo.save(testRoom);
-      repo.save(testOperationTeam1);
-      repo.save(testOperation);
-    } catch (Exception e){
-      e.printStackTrace();
-    }
-
-    //repo.deleteOperationTeam(testOperationTeam.id());
-    repo.deleteOperation(testOperation.id());
-
-    assertFalse(repo.findOperation(testOperation.id()).isPresent());
-  }
-
-  @Test
-  public void testCreateOperation() throws Exception {
-
-    repo.save(testRoom);
+    repo.save(testRoom1);
     repo.save(testOperationTeam1);
 
     Operation.Create createCommand = new Operation.Create(
@@ -230,7 +159,7 @@ public final class Tests
             LocalTime.of(11, 0, 0),
             testPatient.id(),
             testOperationTeam1.id(),
-            testRoom.id()
+            testRoom1.id()
     );
 
     Operation createdOperation = operationService.process(createCommand);
@@ -243,7 +172,7 @@ public final class Tests
   @Test
   public void testUpdateOperation() throws Exception {
 
-    repo.save(testRoom);
+    repo.save(testRoom1);
     repo.save(testOperationTeam1);
     repo.save(testOperation);
 
@@ -275,9 +204,9 @@ public final class Tests
   }
 
   @Test
-  public void testDeleteOperation() throws Exception {
+  public void testDeleteOperation() {
 
-    repo.save(testRoom);
+    repo.save(testRoom1);
     repo.save(testOperationTeam1);
     repo.save(testOperation);
     repo.save(testPreparationNote1);
@@ -295,7 +224,7 @@ public final class Tests
   @Test
   public void testGetOperation() throws Exception {
 
-    repo.save(testRoom);
+    repo.save(testRoom1);
     repo.save(testOperationTeam1);
     repo.save(testOperation);
 
@@ -316,9 +245,9 @@ public final class Tests
   }
 
   @Test
-  public void testGetOperations() throws Exception {
+  public void testGetOperations() {
 
-    repo.save(testRoom);
+    repo.save(testRoom1);
     repo.save(testOperationTeam1);
     repo.save(testOperation);
 
@@ -333,69 +262,9 @@ public final class Tests
     }
   }
 
-  @Ignore
-  @Test
-  public void testRepoOPStaffSave(){
-
-    try {
-      repo.save(testOPStaff1);
-    } catch (Exception e){
-      e.printStackTrace();
-    }
-
-    assertTrue(
-            repo.findOPStaff(testOPStaff1.id()).isPresent()
-    );
-  }
-
-  @Ignore
-  @Test
-  public void testRepoOPStaffUpdate() throws Exception {
-
-    try {
-      repo.save(testOPStaff1);
-    } catch (Exception e){
-      e.printStackTrace();
-    }
-
-    OPStaff updatedTestOPStaff = new OPStaff(
-            testOPStaff1.id(),
-            Role.SURGEON,
-            testOPStaff1.specialty(),
-            Instant.now()
-    );
-
-    try {
-      repo.save(updatedTestOPStaff);
-    } catch (Exception e){
-      e.printStackTrace();
-    }
-
-    Optional<OPStaff> readOPStaff = repo.findOPStaff(updatedTestOPStaff.id());
-    if (readOPStaff.isPresent()) {
-      assertNotEquals(readOPStaff.get().role(), testOPStaff1.role());
-      assertNotEquals(readOPStaff.get().lastUpdate(), testOPStaff1.lastUpdate());
-    } else {
-      throw new Exception();
-    }
-  }
-
-  @Ignore
-  @Test
-  public void testRepoOPStaffDelete() {
-    try {
-      repo.save(testOPStaff1);
-    } catch (Exception e){
-      e.printStackTrace();
-    }
-
-    repo.deleteOPStaff(testOPStaff1.id());
-
-    assertFalse(repo.findOPStaff(testOPStaff1.id()).isPresent());
-  }
 
   @Test
-  public void testCreateOPStaff() throws Exception {
+  public void testCreateOPStaff() {
 
     OPStaff.Create createCommand = new OPStaff.Create(
             Role.ASSISTANT,
@@ -436,7 +305,7 @@ public final class Tests
   }
 
   @Test
-  public void testDeleteOPStaff() throws Exception {
+  public void testDeleteOPStaff() {
 
     repo.save(testOPStaff1);
 
@@ -465,73 +334,14 @@ public final class Tests
   }
 
 
-  @Ignore
   @Test
-  public void testRepoOperationTeamUpdate() throws Exception {
-
-    try {
-      repo.save(testOPStaff1);
-      repo.save(testOPStaff2);
-      repo.save(testOperationTeam1);
-      repo.assignOPStaffToOperationTeam(testOperationTeam1.id(), testOPStaff1.id());
-      repo.assignOPStaffToOperationTeam(testOperationTeam1.id(), testOPStaff2.id());
-    } catch (Exception e){
-      e.printStackTrace();
-    }
-
-    OperationTeam updatedTestOperationTeam = new OperationTeam(
-            testOperationTeam1.id(),
-            testOperationTeam1.opStaffs(),
-            "team22",
-            Instant.now()
-    );
+  public void testCreateOperationTeam() {
 
-    try {
-      repo.save(updatedTestOperationTeam);
-    } catch (Exception e){
-      e.printStackTrace();
-    }
-
-    Optional<OperationTeam> readOperationTeam = repo.findOperationTeam(updatedTestOperationTeam.id());
-    if (readOperationTeam.isPresent()) {
-      assertNotEquals(readOperationTeam.get().teamName(), testOperationTeam1.teamName());
-      assertNotEquals(readOperationTeam.get().lastUpdate(), testOperationTeam1.lastUpdate());
-    } else {
-      throw new Exception();
-    }
-  }
-
-  @Ignore
-  @Test
-  public void testRepoOperationTeamDelete() {
-    try {
-      repo.save(testOPStaff1);
-      repo.save(testOPStaff2);
-      repo.save(testOperationTeam1);
-      repo.assignOPStaffToOperationTeam(testOperationTeam1.id(), testOPStaff1.id());
-      repo.assignOPStaffToOperationTeam(testOperationTeam1.id(), testOPStaff2.id());
-    } catch (Exception e){
-      e.printStackTrace();
-    }
-
-    repo.deleteOperationTeam(testOperationTeam1.id());
-
-    assertFalse(repo.findOperationTeam(testOperationTeam1.id()).isPresent());
-  }
-
-
-  @Ignore
-  @Test
-  public void testCreateOperationTeam() throws Exception {
-
-    repo.save(testRoom);
-    repo.save(testOperation);
-    repo.save(testOPStaff1);
-    repo.save(testOPStaff2);
+    repo.save(testOPStaff3);
 
     OperationTeam.Create createCommand = new OperationTeam.Create(
             "Team33",
-            testOperationTeam1.opStaffs()
+            testOperationTeam2.opStaffs()
     );
 
     OperationTeam createdOperationTeam = operationTeamService.process(createCommand);
@@ -546,7 +356,7 @@ public final class Tests
 
 
   @Test
-  public void testDeleteOperationTeam() throws Exception {
+  public void testDeleteOperationTeam() {
 
     repo.save(testOPStaff3);
     repo.save(testOperationTeam2);
@@ -562,59 +372,69 @@ public final class Tests
     assertFalse(repo.findOperationTeam(deletedOperationTeam.id()).isPresent());
   }
 
-  @Ignore
   @Test
   public void testGetOperationTeam() throws Exception {
-    repo.save(testOPStaff1);
-    repo.save(testOPStaff2);
-    repo.save(testOperationTeam1);
+    repo.save(testOPStaff3);
+    repo.save(testOperationTeam2);
 
-    repo.assignOPStaffToOperationTeam(testOperationTeam1.id(), testOPStaff1.id());
-    repo.assignOPStaffToOperationTeam(testOperationTeam1.id(), testOPStaff2.id());
+    repo.assignOPStaffToOperationTeam(testOperationTeam2.id(), testOPStaff3.id());
 
-    Optional<OperationTeam> readOperationTeam = operationTeamService.getOperationTeam(testOperationTeam1.id());
+    Optional<OperationTeam> readOperationTeam = operationTeamService.getOperationTeam(testOperationTeam2.id());
 
     if (readOperationTeam.isPresent()) {
-      assertEquals(testOperationTeam1.id(), readOperationTeam.get().id());
-      assertEquals(testOperationTeam1.teamName(), readOperationTeam.get().teamName());
+      assertEquals(testOperationTeam2.id(), readOperationTeam.get().id());
+      assertEquals(testOperationTeam2.teamName(), readOperationTeam.get().teamName());
 
       for(int i = 0; i < readOperationTeam.get().opStaffs().size(); i++) {
-        assertEquals(testOperationTeam1.opStaffs().get(i).id(), readOperationTeam.get().opStaffs().get(i).id());
+        assertEquals(testOperationTeam2.opStaffs().get(i).id(), readOperationTeam.get().opStaffs().get(i).id());
       }
     } else {
       throw new Exception();
     }
   }
 
-
-  @Ignore
   @Test
-  public void testRepoOperationTeamAssignStaff(){
+  public void testAssignStaffToOperationTeam() {
 
-    try {
-      repo.save(testOperationTeam1);
-      for(OPStaff opStaff : testOperationTeam1.opStaffs()) {
-        repo.save(opStaff);
-        repo.assignOPStaffToOperationTeam(testOperationTeam1.id(), opStaff.id());
-      }
-    } catch (Exception e){
-      e.printStackTrace();
-    }
+    repo.save(testOperationTeam2);
+    repo.save(testOPStaff3);
 
-    assertTrue(
-            repo.findOperationTeam(testOperationTeam1.id()).isPresent()
+    OperationTeam.AssignStaff assignStaffCommand = new OperationTeam.AssignStaff(
+            testOperationTeam2.id(),
+            testOPStaff3.id()
     );
 
-    for(OPStaff opStaff : testOperationTeam1.opStaffs()) {
-      assertTrue(repo.findOperationTeamOPStaff(testOperationTeam1.id(), opStaff.id()));
-    }
+    OperationTeam assignedStaffOperationTeam = operationTeamService.process(assignStaffCommand);
+
+    Boolean result = repo.findOperationTeamOPStaff(assignedStaffOperationTeam.id(), testOPStaff3.id());
+
+    assertTrue(result);
   }
 
+  @Test
+  public void testRemoveOPStaffsInOperationTeams() {
+
+    repo.save(testOperationTeam2);
+    repo.save(testOPStaff3);
+
+    repo.assignOPStaffToOperationTeam(testOperationTeam2.id(), testOPStaff3.id());
+
+    OperationTeam.RemoveStaff removeStaffCommand = new OperationTeam.RemoveStaff(
+            testOperationTeam2.id(),
+            testOPStaff3.id()
+    );
+
+    OperationTeam removedTeam = operationTeamService.process(removeStaffCommand);
+
+    assertEquals(testOperationTeam2.id().value(), removedTeam.id().value());
+    assertFalse(repo.findOperationTeamOPStaff(testOperationTeam2.id(), testOPStaff3.id()));
+  }
 
 
-  @Ignore
   @Test
-  public void testCreatePreparationNote() throws Exception {
+  public void testCreatePreparationNote() {
+
+    repo.save(testOperation);
 
     PreparationNote.Create createCommand = new PreparationNote.Create(
             ("Notiz erstellt mit Command"),
@@ -628,14 +448,15 @@ public final class Tests
     );
   }
 
-
-  @Ignore
   @Test
   public void testUpdatePreparationNote() throws Exception {
 
+    repo.save(testOperation);
+    repo.save(testPreparationNote1);
+
     PreparationNote.Update updateCommand = new PreparationNote.Update(
             testPreparationNote1.id(),
-            ("COmmand wurde hier geupdaet!?!?!?!?")
+            ("Notiz wurde geupdated")
     );
 
     PreparationNote updatePreparationNote = preparationNoteService.process(updateCommand);
@@ -645,7 +466,7 @@ public final class Tests
     if (readPreparationNote.isPresent()) {
       assertNotEquals(readPreparationNote.get().note(), testPreparationNote1.note());
 
-      assertEquals(readPreparationNote.get().operationsId(), testPreparationNote1.operationsId());
+      assertEquals(readPreparationNote.get().id(), testPreparationNote1.id());
 
       assertEquals(readPreparationNote.get().id(), testPreparationNote1.id());
 
@@ -655,11 +476,10 @@ public final class Tests
     }
   }
 
-
-  @Ignore
   @Test
-  public void testDeletePreparationNote() throws Exception {
+  public void testDeletePreparationNote() {
 
+    repo.save(testOperation);
     repo.save(testPreparationNote1);
 
     PreparationNote.Delete deleteCommand = new PreparationNote.Delete(
@@ -671,56 +491,22 @@ public final class Tests
     assertFalse(repo.findPreparationNote(deletePreparationNote.id()).isPresent());
   }
 
-  @Ignore
   @Test
-  public void testRepoPreparationNoteSave(){
-
-    try {
-      repo.save(testPreparationNote1);
-    } catch (Exception e){
-      e.printStackTrace();
-    }
+  public void testGetPreparationNote() {
 
-    assertTrue(
-            repo.findPreparationNote(testPreparationNote1.id()).isPresent()
-    );
-  }
-
-
-
-  @Ignore
-  @Test
-  public void testRepoPreparationNoteUpdate() throws Exception {
-
-    try {
-      repo.save(testPreparationNote1);
-    } catch (Exception e){
-      e.printStackTrace();
-    }
-
-    PreparationNote updatedTestPreparatioNote = new PreparationNote(
-            testPreparationNote1.id(),
-            ("ES WURDE GEUPDATED!!!"),
-            testPreparationNote1.operationsId(),
-            Instant.now()
-    );
+    repo.save(testOperation);
+    repo.save(testPreparationNote2);
 
-    try {
-      repo.save(updatedTestPreparatioNote);
-    } catch (Exception e){
-      e.printStackTrace();
-    }
+    Optional<PreparationNote> readPreparationNote = preparationNoteService.getPreparationNote(testPreparationNote2.id());
 
-    Optional<PreparationNote> readPreparationNote = repo.findPreparationNote(updatedTestPreparatioNote.id());
     if (readPreparationNote.isPresent()) {
-      assertNotEquals(readPreparationNote.get().note(), testPreparationNote1.note());
-      assertNotEquals(readPreparationNote.get().lastUpdate(), testPreparationNote1.lastUpdate());
-    } else {
-      throw new Exception();
+      assertEquals(testPreparationNote2.id(), readPreparationNote.get().id());
+      assertEquals(testPreparationNote2.note(), readPreparationNote.get().note());
+      assertEquals(testPreparationNote2.operationId().value(), readPreparationNote.get().operationId().value());
     }
   }
 
-  @Ignore
+
   @Test
   public void testCreateRoom() throws Exception{
 
@@ -730,20 +516,19 @@ public final class Tests
 
     Room createdRoom = roomService.process(createCommand);
 
-    assertNotNull("Room should be created", createdRoom);
-    assertNotNull("Room ID should not be null", createdRoom.id());
     assertTrue(
             repo.findRoom(createdRoom.id()).isPresent()
     );
   }
 
-  @Ignore
   @Test
-  public void testRoomUpdate() throws Exception {
-    // repo.save(testRoom);
+  public void testUpdateRoom() throws Exception {
+
+    repo.save(testRoom1);
+
     Room.Update updateCommand = new Room.Update(
-            testRoom.id(),
-            ("COmmand wurde hier geupdaet!?!?!?!?")
+            testRoom1.id(),
+            ("NeuerRaumName")
     );
 
     Room updateRoom = roomService.process(updateCommand);
@@ -751,24 +536,23 @@ public final class Tests
     Optional<Room> readRoom = repo.findRoom(updateRoom.id());
 
     if (readRoom.isPresent()) {
-      assertNotEquals(readRoom.get().roomName(), testRoom.roomName());
+      assertNotEquals(readRoom.get().roomName(), testRoom1.roomName());
 
-      assertEquals(readRoom.get().id(), testRoom.id());
+      assertEquals(readRoom.get().id(), testRoom1.id());
 
-      assertNotEquals(readRoom.get().lastUpdate(), testRoom.lastUpdate());
+      assertNotEquals(readRoom.get().lastUpdate(), testRoom1.lastUpdate());
     } else {
       throw new Exception();
     }
   }
 
-  @Ignore
   @Test
   public void testDeleteRoom() throws Exception {
 
-    //  repo.save(testRoom);
+    repo.save(testRoom2);
 
     Room.Delete deleteCommand = new Room.Delete(
-            testRoom.id()
+            testRoom2.id()
     );
 
     Room deleteRoom = roomService.process(deleteCommand);
@@ -776,54 +560,16 @@ public final class Tests
     assertFalse(repo.findRoom(deleteRoom.id()).isPresent());
   }
 
-
-  @Ignore
-  @Test
-  public void testRepoAssignStaffToOperationTeam() throws Exception {
-
-    repo.save(testOperationTeam1);
-    repo.save(testOPStaff1);
-
-    Boolean result = repo.assignOPStaffToOperationTeam(testOperationTeam1.id(), testOPStaff1.id());
-
-    assertTrue(result);
-  }
-
-  @Ignore
-  @Test
-  public void testAssignStaffToOperationTeam() throws Exception {
-
-    repo.save(testOperationTeam1);
-    repo.save(testOPStaff1);
-
-    OperationTeam.AssignStaff assignStaffCommand = new OperationTeam.AssignStaff(
-            testOperationTeam1.id(),
-            testOPStaff1.id()
-    );
-
-    OperationTeam assignedStaffOperationTeam = operationTeamService.process(assignStaffCommand);
-
-    Boolean result = repo.findOperationTeamOPStaff(assignedStaffOperationTeam.id(), testOPStaff1.id());
-
-    assertTrue(result);
-  }
-
-
-
-
-  @Ignore
   @Test
-  public void testRemoveOPStaffsInOperationTeams() throws Exception{
+  public void testGetRoom() {
+    repo.save(testRoom1);
 
-    OperationTeam.RemoveStaff removeStaffCommand= new OperationTeam.RemoveStaff(
-            testOperationTeam1.id(),
-            testOPStaff1.id()
-    );
-
-    OperationTeam removedTeam = operationTeamService.process(removeStaffCommand);
+    Optional<Room> readRoom = roomService.getRoom(testRoom1.id());
 
-    assertEquals(testOperationTeam1.id().value(), removedTeam.id().value());
-    assertFalse(repo.findOperationTeamOPStaff(testOperationTeam1.id(), testOPStaff1.id()));
+    if (readRoom.isPresent()) {
+      assertEquals(testRoom1.id(), readRoom.get().id());
+      assertEquals(testRoom1.roomName(), readRoom.get().roomName());
+    }
   }
 }
 
-- 
GitLab