Esempio n. 1
0
  @Test
  public void testAutoFill() throws Exception {
    // Does not throw error if patient is null
    new Appointment(entityManager).autoFill();

    Patient patient = new Patient(entityManager);
    Appointment app = new Appointment(entityManager).setPatient(patient).autoFill();
    assertNull(app.getNurseId());
    assertNull(app.getStart());
    assertNull(app.getEnd());

    Appointment last =
        new Appointment(entityManager)
            .setNurseId(42)
            .setStart(DateTime.parse("2014-12-23T07:43:00"))
            .setEnd(DateTime.parse("2014-12-23T08:30:00"));
    patient.addAppointment(last);
    app.autoFill();
    assertEquals(42, app.getNurseId().intValue());
    assertEquals("" + last.getStartTime(), "" + app.getStartTime());
    assertEquals("" + last.getEndTime(), "" + app.getEndTime());

    app = new Appointment(entityManager).setPatient(patient).setStart(DateTime.parse("2014-12-29"));
    app.autoFill();
    assertEquals(42, app.getNurseId().intValue());
    assertEquals(12, app.getStart().getMonthOfYear());
    assertEquals(29, app.getStart().getDayOfMonth());
    assertEquals(2014, app.getStart().getYear());
    assertEquals("" + last.getStartTime(), "" + app.getStartTime());
    assertEquals("" + last.getEndTime(), "" + app.getEndTime());
  }
Esempio n. 2
0
 @Test
 @Ignore
 public void testInsert() throws Exception {
   Patient patient = entityManager.find(Patient.class, 3);
   appointment =
       new Appointment(entityManager)
           .setStart(new DateTime(Calculate.getCal(2013, 02, 18, 8, 48, 48)))
           .setEnd(new DateTime(FormatText.USER_DATETIME.parse("02/18/2013 10:48:48")));
   patient.addAppointment(appointment);
 }
Esempio n. 3
0
 @Test
 @Ignore
 public void testRead() {
   Patient patient = entityManager.find(Patient.class, 3);
   assertTrue(patient.getAppointments().size() > 0);
   DateTime st = patient.getAppointments().iterator().next().getStart();
   assertEquals(2013, st.getYear());
   assertEquals(2, st.getMonthOfYear());
   assertEquals(18, st.getDayOfMonth());
   assertEquals(8, st.getHourOfDay());
 }