Esempio n. 1
0
 @Test
 public void testSetPropertyD() throws Exception {
   Appointment app = new Appointment(null);
   app.setPropertyValue("MILEAGE", "500");
   assertEquals(500, app.getMileageD(), .0001);
   app.setPropertyValue("MILEAGE_D", "501");
   assertEquals(501, app.getMileage(), .0001);
   app.setPropertyValue("MILEAGE", "50000");
   assertEquals(50000, app.getMileage(), .0001);
   app.setPropertyValue("MILEAGE_D", "50000");
   assertEquals(50000, app.getMileage(), .0001);
 }
Esempio n. 2
0
  @Test
  public void testMileage() throws Exception {
    Appointment app =
        new Appointment(null)
            .setStart(DateTime.now())
            .setNurse(new Nurse(null).setMileageRate(.5))
            .setPatient(new Patient(null).setVendor(new Vendor(null).setMileageRate(.4)));

    // If we set no mileage there should be no mileage.
    assertEquals(0, app.getMileage(), .0001);
    assertEquals(0, app.getPayMileage(), .0001);
    assertEquals(0, app.getBillingMileage(), .0001);
    assertEquals(.5, app.getPayMileageRate(), .0001);
    assertEquals(.4, app.getBillingMileageRate(), .0001);

    // Setting the Driven Miles less than 20 will result in the pay/billable being zero
    app.setMileageD(10);
    assertEquals(10, app.getMileage(), .0001);
    assertEquals(0, app.getPayMileage(), .0001);
    assertEquals(0, app.getBillingMileage(), .0001);
    assertEquals(.5, app.getPayMileageRate(), .0001);
    assertEquals(.4, app.getBillingMileageRate(), .0001);

    // Setting the Driven Miles greater than 20 will result in the pay/billable being (driven - 20)
    app.setMileageD(25);
    assertEquals(25, app.getMileage(), .0001);
    assertEquals(5, app.getPayMileage(), .0001);
    assertEquals(5, app.getBillingMileage(), .0001);
    assertEquals(.5, app.getPayMileageRate(), .0001);
    assertEquals(.4, app.getBillingMileageRate(), .0001);

    // Setting the billable miles will override the payable miles if not set.
    app.setBillingMileageD(20);
    assertEquals(25, app.getMileage(), .0001);
    assertEquals(20, app.getBillingMileage(), .0001);
    assertEquals(20, app.getPayMileage(), .0001);
    assertEquals(.5, app.getPayMileageRate(), .0001);
    assertEquals(.4, app.getBillingMileageRate(), .0001);

    // Setting the payable miles will override the billable miles if not set.
    app.setBillingMileageD(-1);
    app.setPayMileageD(15);
    assertEquals(25, app.getMileage(), .0001);
    assertEquals(15, app.getBillingMileage(), .0001);
    assertEquals(15, app.getPayMileage(), .0001);
    assertEquals(.5, app.getPayMileageRate(), .0001);
    assertEquals(.4, app.getBillingMileageRate(), .0001);

    // You can zero out pay and billable if you like.
    app.setBillingMileageD(0);
    app.setPayMileageD(0);
    assertEquals(25, app.getMileage(), .0001);
    assertEquals(0, app.getBillingMileage(), .0001);
    assertEquals(0, app.getPayMileage(), .0001);
    assertEquals(.5, app.getPayMileageRate(), .0001);
    assertEquals(.4, app.getBillingMileageRate(), .0001);
  }
Esempio n. 3
0
  @Test
  public void testMileageMultiAppointment() throws Exception {
    Nurse nurse = new Nurse(null).setMileageRate(.5);
    Appointment app1 =
        new Appointment(null)
            .setStart(DateTime.parse("2014-08-09T07:00:00"))
            .setNurse(nurse)
            .setPatient(new Patient(null).setVendor(new Vendor(null).setMileageRate(.4)));
    Appointment app2 =
        new Appointment(null)
            .setStart(DateTime.parse("2014-08-10T10:15:00"))
            .setNurse(nurse)
            .setPatient(new Patient(null).setVendor(new Vendor(null).setMileageRate(.4)));
    Appointment app3 =
        new Appointment(null)
            .setStart(DateTime.parse("2014-08-09T10:15:00"))
            .setNurse(nurse)
            .setPatient(new Patient(null).setVendor(new Vendor(null).setMileageRate(.4)));
    nurse.addAppointment(app1).addAppointment(app2).addAppointment(app3);

    assertNull(app1.getPrevSameNurseDayApp());
    assertNull(app2.getPrevSameNurseDayApp());
    assertEquals(app1, app3.getPrevSameNurseDayApp());

    // If we set no mileage there should be no mileage.
    assertEquals(0, app1.getMileage(), .0001);
    assertEquals(0, app1.getPayMileage(), .0001);
    assertEquals(20, app1.getSelfPaidMileage(), .0001);
    assertEquals(0, app2.getMileage(), .0001);
    assertEquals(0, app2.getPayMileage(), .0001);
    assertEquals(20, app2.getSelfPaidMileage(), .0001);
    assertEquals(0, app3.getMileage(), .0001);
    assertEquals(0, app3.getPayMileage(), .0001);
    assertEquals(20, app3.getSelfPaidMileage(), .0001);

    app1.setMileageD(10);
    app3.setMileageD(5);
    assertEquals(10, app1.getMileage(), .0001);
    assertEquals(0, app1.getPayMileage(), .0001);
    assertEquals(20, app1.getSelfPaidMileage(), .0001);
    // Setting mileage on app1 should have no effect on app2
    assertEquals(0, app2.getMileage(), .0001);
    assertEquals(0, app2.getPayMileage(), .0001);
    assertEquals(20, app2.getSelfPaidMileage(), .0001);
    // The self paid mileage of app3 should be lowered app1 mileage
    assertEquals(5, app3.getMileage(), .0001);
    assertEquals(0, app3.getPayMileage(), .0001);
    assertEquals(10, app3.getSelfPaidMileage(), .0001);

    app1.setMileageD(30);
    assertEquals(30, app1.getMileage(), .0001);
    assertEquals(10, app1.getPayMileage(), .0001);
    assertEquals(20, app1.getSelfPaidMileage(), .0001);
    // Setting mileage on app1 should have no effect on app2
    assertEquals(0, app2.getMileage(), .0001);
    assertEquals(0, app2.getPayMileage(), .0001);
    assertEquals(20, app2.getSelfPaidMileage(), .0001);
    // The self paid mileage of app3 should be lowered app1 mileage
    assertEquals(5, app3.getMileage(), .0001);
    assertEquals(5, app3.getPayMileage(), .0001);
    assertEquals(0, app3.getSelfPaidMileage(), .0001);

    app1.setMileageD(18);
    assertEquals(18, app1.getMileage(), .0001);
    assertEquals(0, app1.getPayMileage(), .0001);
    assertEquals(20, app1.getSelfPaidMileage(), .0001);
    // Setting mileage on app1 should have no effect on app2
    assertEquals(0, app2.getMileage(), .0001);
    assertEquals(0, app2.getPayMileage(), .0001);
    assertEquals(20, app2.getSelfPaidMileage(), .0001);
    // The self paid mileage of app3 should be lowered app1 mileage
    assertEquals(5, app3.getMileage(), .0001);
    assertEquals(3, app3.getPayMileage(), .0001);
    assertEquals(2, app3.getSelfPaidMileage(), .0001);
  }