@Test public void setConvertedProperties_shouldAllowAnyPropertyOrder() throws Exception { ObsResource1_8 resource = getResource(); Obs obs = getObject(); Map<String, Object> propertyMap = new HashMap<String, Object>(); propertyMap.put("value", 10.0); propertyMap.put("person", RestTestConstants1_8.PERSON_UUID); propertyMap.put("concept", "c607c80f-1ea9-4da3-bb88-6276ce8868dd"); propertyMap.put("obsDatetime", "2013-12-09T00:00:00.000+0100"); resource.setConvertedProperties(obs, propertyMap, resource.getUpdatableProperties(), false); org.springframework.util.Assert.isTrue(((Double) ObsResource1_8.getValue(obs)) == 10.0); } }
@Test public void setValue_shouldReturnUuidForConceptFalse() throws Exception { Obs obs = new Obs(); obs.setConcept(Context.getConceptService().getConceptByUuid(BOOLEAN_CONCEPT_UUID)); ObsResource1_8.setValue(obs, falseConcept); assertEquals(falseConcept, ObsResource1_8.getValue(obs)); }
@Test public void setValue_shouldReturnUuidForConceptTrue() throws Exception { Obs obs = new Obs(); obs.setConcept(Context.getConceptService().getConceptByUuid(BOOLEAN_CONCEPT_UUID)); ObsResource1_8.setValue(obs, trueConcept); assertEquals(trueConcept, ObsResource1_8.getValue(obs)); }
@Test public void setValue_shouldReturnUuidForPrimitiveTrue() throws Exception { Obs obs = new Obs(); obs.setConcept(Context.getConceptService().getConceptByUuid(BOOLEAN_CONCEPT_UUID)); ObsResource1_8.setValue(obs, true); assertEquals(trueConcept, ObsResource1_8.getValue(obs)); }
@Test public void setValue_shouldReturnUuidForPrimitiveFalse() throws Exception { Obs obs = new Obs(); obs.setConcept(Context.getConceptService().getConceptByUuid(BOOLEAN_CONCEPT_UUID)); ObsResource1_8.setValue(obs, false); assertEquals(falseConcept, ObsResource1_8.getValue(obs)); }
@Test public void setValue_shouldReturnDrug() throws Exception { Obs obs = new Obs(); Concept concept = Context.getConceptService().getConceptByUuid("89ca642a-dab6-4f20-b712-e12ca4fc6d36"); obs.setConcept(concept); // drug String drugUuid = "3cfcf118-931c-46f7-8ff6-7b876f0d4202"; Drug drug = Context.getConceptService().getDrugByUuid(drugUuid); ObsResource1_8.setValue(obs, drugUuid); assertEquals(drug, ObsResource1_8.getValue(obs)); }