@Test
 public void shouldAssignPatientToBed() throws Exception {
   PatientService patientService = Context.getPatientService();
   Patient patient = patientService.getPatient(5);
   BedDetails bedDetails = bedManagementService.getBedAssignmentDetailsByPatient(patient);
   assertNull(bedDetails);
   EncounterService encounterService = Context.getEncounterService();
   List<Encounter> encountersByPatient = encounterService.getEncountersByPatient(patient);
   bedManagementService.assignPatientToBed(patient, encountersByPatient.get(0), "10");
   BedDetails assigned = bedManagementService.getBedAssignmentDetailsByPatient(patient);
   assertNotNull(assigned);
   assertNotNull(assigned.getCurrentAssignments());
   assertNull(assigned.getLastAssignment());
 }
  @Test
  public void shouldAssignUnassignExistingPatientFromBed() throws Exception {
    int bedId = 9;
    PatientService patientService = Context.getPatientService();
    Patient patient = patientService.getPatient(3);

    EncounterService encounterService = Context.getEncounterService();
    List<Encounter> encountersByPatient = encounterService.getEncountersByPatient(patient);

    BedDetails bedDetails = bedManagementService.getBedAssignmentDetailsByPatient(patient);
    assertNotNull(bedDetails);
    Assert.assertEquals(11, bedDetails.getBedId());

    bedManagementService.assignPatientToBed(
        patient, encountersByPatient.get(0), String.valueOf(bedId));

    bedDetails = bedManagementService.getBedAssignmentDetailsByPatient(patient);
    assertEquals(bedId, bedDetails.getBedId());
  }