@Override protected Form getObjectByUuid(String uuid) { return Context.getFormService().getFormByUuid(uuid); } }
/** * @see FormService#getFormByUuid(String) */ @Test public void getFormByUuid_shouldReturnNullIfNoObjectFoundWithGivenUuid() { Assert.assertNull(Context.getFormService().getFormByUuid("some invalid uuid")); }
/** * @see FormService#getFormByUuid(String) */ @Test public void getFormByUuid_shouldFindObjectGivenValidUuid() { String uuid = "d9218f76-6c39-45f4-8efa-4c5c6c199f50"; Form form = Context.getFormService().getFormByUuid(uuid); assertEquals(1, (int) form.getFormId()); }
form = Context.getFormService().getFormByUuid(uuid);
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getByUniqueId(java.lang.String) */ @Override public Form getByUniqueId(String uniqueId) { return Context.getFormService().getFormByUuid(uniqueId); }
@Override public Form newObject() { return Context.getFormService().getFormByUuid(getUuidProperty()); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResourceTest#newObject() */ @Override public Form newObject() { return Context.getFormService().getFormByUuid(getUuidProperty()); }
@Test public void shouldListFormResourcesForAForm() throws Exception { MockHttpServletResponse response = handle(newGetRequest(getURI())); List<Object> resources = Util.getResultsList(deserialize(response)); List<FormResource> resourceObjects = (List<FormResource>) formService.getFormResourcesForForm(formService .getFormByUuid(RestTestConstants1_9.FORM_UUID)); List<String> names = new ArrayList<String>(); for (Object resource : resources) { names.add((String) PropertyUtils.getProperty(resource, "name")); } Assert.assertEquals(resourceObjects.size(), resources.size()); Assert.assertTrue(names.contains("Resource 1")); Assert.assertTrue(names.contains("Resource 2")); Assert.assertTrue(names.contains("Resource 3")); }