Exemplo n.º 1
0
 @Test
 public void testPopulateDrugStrengthNormalInput() {
   Drug d = new Drug();
   DrugTo1 t = new DrugTo1();
   t.setStrengthUnit("mg");
   t.setStrength((float) 100);
   Boolean result = this.populateDrugStrength(d, t);
   assertEquals("100.0 mg", d.getDosage());
   assertEquals("mg", d.getUnit());
   assertTrue(result);
 }
Exemplo n.º 2
0
  @Test
  public void testPopulateDrugStrengthNoValidStrengthUnit() {
    Drug d = new Drug();
    DrugTo1 t = new DrugTo1();
    t.setStrengthUnit(null);
    t.setStrength((float) 100);

    Boolean result = this.populateDrugStrength(d, t);

    assertFalse(result);
  }
Exemplo n.º 3
0
  @Test
  public void testPopulateTo1StrengthNonNullStrength() {

    DrugTo1 t = new DrugTo1();
    Drug d = new Drug();

    t.setStrength((float) 100.0);

    // aspirin will trigger response from MockDrugLookUpManager
    d.setBrandName("aspirin");

    Boolean resp = this.populateTo1Strength(t, d);

    assertFalse(resp);
    assertEquals((float) 100.0, t.getStrength());
  }
Exemplo n.º 4
0
  @Test
  public void testTransferToDomainObject() {

    DrugTo1 t = new DrugTo1();

    LoggedInInfo info = new LoggedInInfo();

    Date startDate = new Date();
    Date endDate = new Date();
    Date archivedDate = new Date();

    t.setDemographicNo(1);
    t.setProviderNo(1);
    t.setGenericName("bangbar");
    t.setBrandName("foobar");
    t.setRegionalIdentifier("12345");
    t.setAtc("abcde");
    t.setTakeMax((float) 2.0);
    t.setTakeMin((float) 1.0);
    t.setRxDate((Date) startDate.clone());
    t.setEndDate((Date) endDate.clone());
    t.setFrequency("BID");
    t.setDuration(28);
    t.setDurationUnit("D");
    t.setRoute("PO");
    t.setForm("TAB");
    t.setPrn(false);
    t.setMethod("take");
    t.setRepeats(5);
    t.setInstructions("some string");
    t.setArchived(false);
    t.setArchivedReason("reason");
    t.setArchivedDate((Date) archivedDate.clone());
    t.setStrength(new Float(10.0));
    t.setStrengthUnit("MG");
    t.setExternalProvider("foo");
    t.setLongTerm(false);
    t.setNoSubstitutions(false);

    Drug d = this.getAsDomainObject(info, t);

    assertEquals(1, (int) d.getDemographicId());
    assertEquals("1", d.getProviderNo());
    assertEquals("bangbar", d.getGenericName());
    assertEquals("foobar", d.getBrandName());
    assertEquals("12345", d.getRegionalIdentifier());
    assertEquals("abcde", d.getAtc());
    assertEquals(1.0, d.getTakeMin(), 0.01);
    assertEquals(2.0, d.getTakeMax(), 0.01);
    assertEquals(startDate.toString(), d.getRxDate().toString());
    assertEquals(endDate.toString(), d.getEndDate().toString());
    assertEquals("BID", d.getFreqCode());
    assertEquals("28", d.getDuration());
    assertEquals("D", d.getDurUnit());
    assertEquals("PO", d.getRoute());
    assertEquals("TAB", d.getDrugForm());
    assertEquals("take", d.getMethod());
    assertEquals("some string", d.getSpecial());
    assertFalse(d.isPrn());
    assertEquals("reason", d.getArchivedReason());
    assertFalse(d.isArchived());
    assertEquals(archivedDate.toString(), d.getArchivedDate().toString());
    assertFalse(d.isLongTerm());
    assertFalse(d.isNoSubs());
    assertEquals("foo", d.getOutsideProviderName());
  }