org.openmrs.Obs.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中org.openmrs.Obs.<init>()方法的一些代码示例,展示了Obs.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Obs.<init>()方法的具体详情如下:
包路径:org.openmrs.Obs
类名称:Obs
方法名:<init>

Obs.<init>介绍

[英]default constructor
[中]默认构造函数

代码示例

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Obs#setGroupMembers(Set)
 */
@Test
public void setGroupMembers_shouldNotMarkTheExistingObsAsDirtyWhenTheSetIsChangedFromNullToANonEmptyOne() throws Exception {
  Obs obs = new Obs(5);
  assertNull(Obs.class.getDeclaredField("groupMembers").get(obs));
  Set<Obs> members = new HashSet<>();
  members.add(new Obs());
  obs.setGroupMembers(members);
  assertFalse(obs.isDirty());
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Obs#setValueAsString(String)
 */
@Test(expected = RuntimeException.class)
public void setValueAsString_shouldFailIfTheValueOfTheStringIsNull() throws Exception {
  Obs obs = new Obs();
  obs.setValueAsString(null);
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Obs#setFormField(String,String)
 */
@Test(expected = APIException.class)
public void setFormField_shouldRejectAPathContainingTheSeparator() throws Exception {
  final String path = FORM_NAMESPACE_PATH_SEPARATOR + "my path";
  Obs obs = new Obs();
  obs.setFormField("", path);
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Obs#removeGroupMember(Obs)
 */
@Test
public void removeGroupMember_shouldReturnFalseWhenANonExistentObsIsRemoved() throws Exception {
  Obs obs = new Obs();
  obs.removeGroupMember(new Obs());
  assertFalse(obs.isDirty());
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Obs#setValueAsString(String)
 */
@Test(expected = RuntimeException.class)
public void setValueAsString_shouldFailIfTheValueOfTheStringIsEmpty() throws Exception {
  Obs obs = new Obs();
  obs.setValueAsString("");
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Encounter#addObs(Obs)
 */
@Test
public void addObs_shouldAddObsToNonNullInitialObsSet() {
  Encounter encounter = new Encounter();
  Set<Obs> obsSet = new HashSet<>();
  obsSet.add(new Obs(1));
  
  encounter.setObs(obsSet);
  
  encounter.addObs(new Obs(2));
  assertEquals(2, encounter.getAllObs(true).size());
}

代码示例来源:origin: openmrs/openmrs-core

@Test
public void shouldSetFinalStatusOnNewObsByDefault() throws Exception {
  Obs obs = new Obs();
  assertThat(obs.getStatus(), is(Obs.Status.FINAL));
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Obs#isObsGrouping()
 */
@Test
public void isObsGrouping_shouldIncludeVoidedObs() throws Exception {
  Obs parent = new Obs(5);
  Obs child = new Obs(33);
  child.setVoided(true);
  parent.addGroupMember(child);
  assertTrue("When checking for Obs grouping, should include voided Obs", parent.isObsGrouping());
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Obs#getValueAsBoolean()
 */
@Test
public void getValueAsBoolean_shouldReturnNullForValue_numericConceptsIfValueIsNeither1Nor0() throws Exception {
  Obs obs = new Obs();
  obs.setValueNumeric(24.8);
  Assert.assertNull(obs.getValueAsBoolean());
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Obs#getValueAsString(Locale)
 */
@Test
public void getValueAsString_shouldUseCommasOrDecimalPlacesDependingOnLocale() throws Exception {
  Obs obs = new Obs();
  obs.setValueNumeric(123456789.3);
  String str = "123456789,3";
  Assert.assertEquals(str, obs.getValueAsString(Locale.GERMAN));
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Obs#getFormFieldNamespace()
 */
@Test
public void getFormFieldNamespace_shouldReturnNullIfTheNamespaceIsNotSpecified() throws Exception {
  Obs obs = new Obs();
  obs.setFormField("", "my path");
  Assert.assertNull(obs.getFormFieldNamespace());
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Obs#getFormFieldNamespace()
 */
@Test
public void getFormFieldNamespace_shouldReturnTheNamespaceForAFormFieldThatHasNoPath() throws Exception {
  final String ns = "my ns";
  Obs obs = new Obs();
  obs.setFormField(ns, null);
  Assert.assertEquals(ns, obs.getFormFieldNamespace());
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Obs#getFormFieldPath()
 */
@Test
public void getFormFieldPath_shouldReturnTheCorrectPathForAFormFieldWithANamespace() throws Exception {
  final String ns = "my ns";
  final String path = "my path";
  Obs obs = new Obs();
  obs.setFormField(ns, path);
  Assert.assertEquals(path, obs.getFormFieldPath());
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Encounter#getObs()
 */
@Test
public void getObs_shouldNotGetVoidedObs() {
  Encounter enc = new Encounter();
  
  //create and add an Obs
  Obs o = new Obs();
  o.setVoided(true);
  enc.addObs(o);
  
  assertEquals(0, enc.getObs().size());
}

代码示例来源:origin: openmrs/openmrs-core

@Test
public void shouldSupportInterpretationProperty() throws Exception {
  Obs obs = new Obs();
  assertThat(obs.getInterpretation(), nullValue());
  obs.setInterpretation(Obs.Interpretation.NORMAL);
  assertThat(obs.getInterpretation(), is(Obs.Interpretation.NORMAL));
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Encounter#getObs()
 */
@Test
public void getObs_shouldGetObs() {
  Encounter encounter = new Encounter();
  
  //create and add an Obs
  Obs o = new Obs();
  encounter.addObs(o);
  
  assertNotNull(encounter.getObs());
  assertEquals(1, encounter.getObs().size());
}

代码示例来源:origin: openmrs/openmrs-core

private Obs buildObs() {
  Obs newObs = new Obs();
  newObs.setConcept(Context.getConceptService().getConcept(1));
  newObs.setValueNumeric(50d);
  newObs.setLocation(new Location(2));
  return newObs;
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Obs#isDirty()
 */
@Test
public void isDirty_shouldReturnFalseWhenAnImmutableFieldIsChangedFromANullToANonNullValueInNewObs() throws Exception {
  Obs obs = new Obs();
  assertNull(obs.getComment());
  obs.setComment("some non null value");
  assertFalse(obs.isDirty());
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Encounter#addObs(Obs)
 */
@Test
public void addObs_shouldSetEncounterAttributeOnObs() {
  Encounter encounter = new Encounter();
  Obs obs = new Obs();
  encounter.addObs(obs);
  assertTrue(obs.getEncounter().equals(encounter));
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Obs#setFormField(String,String)
 */
@Test
public void setFormField_shouldMarkTheObsAsDirtyWhenTheValueIsChangedFromANullToANonNullValue() throws Exception {
  Obs obs = new Obs(5);
  assertNull(obs.getFormFieldNamespace());
  assertNull(obs.getFormFieldPath());
  obs.setFormField("someNameSpace", "somePath");
  assertTrue(obs.isDirty());
}

相关文章