@Override protected ConceptDatatype getObjectByUuid(String uuid) { return Context.getConceptService().getConceptDatatypeByUuid(uuid); } }
/** * @see ConceptServiceImpl#getAllConceptDatatypes(boolean) */ @Test public void getAllConceptDatatypes_shouldReturnAllConceptDataypesExcludingRetiredOnesWhenGivenFalse() { int resultSize = 12; String uuid = "8d4a4488-c2cc-11de-8d13-0010c6dffd0f"; List<ConceptDatatype> conceptDatatypes = conceptService.getAllConceptDatatypes(false); assertEquals(resultSize, conceptDatatypes.size()); assertTrue(conceptDatatypes.contains(conceptService.getConceptDatatypeByUuid(uuid))); }
/** * @see ConceptServiceImpl#getAllConceptDatatypes() */ @Test public void getAllConceptDatatypes_shouldGiveAListOfAllConceptDataypes() { int resultSize = 12; String uuid = "8d4a4488-c2cc-11de-8d13-0010c6dffd0f"; List<ConceptDatatype> conceptDatatypes = conceptService.getAllConceptDatatypes(); assertEquals(resultSize, conceptDatatypes.size()); assertTrue(conceptDatatypes.contains(conceptService.getConceptDatatypeByUuid(uuid))); }
/** * @see ConceptServiceImpl#getAllConceptDatatypes(boolean) */ @Test public void getAllConceptDatatypes_shouldReturnAllConceptDataypesIncludingRetiredOnesWhenGivenTrue() { int resultSize = 12; String uuid = "8d4a4488-c2cc-11de-8d13-0010c6dffd0f"; List<ConceptDatatype> conceptDatatypes = conceptService.getAllConceptDatatypes(true); assertEquals(resultSize, conceptDatatypes.size()); assertTrue(conceptDatatypes.contains(conceptService.getConceptDatatypeByUuid(uuid))); }
/** * @see ConceptService#getConceptDatatypeByUuid(String) */ @Test public void getConceptDatatypeByUuid_shouldReturnNullIfNoObjectFoundWithGivenUuid() { Assert.assertNull(Context.getConceptService().getConceptDatatypeByUuid("some invalid uuid")); }
/** * @see ConceptService#getConceptDatatypeByUuid(String) */ @Test public void getConceptDatatypeByUuid_shouldFindObjectGivenValidUuid() { String uuid = "8d4a4488-c2cc-11de-8d13-0010c6dffd0f"; ConceptDatatype conceptDatatype = Context.getConceptService().getConceptDatatypeByUuid(uuid); Assert.assertEquals(1, (int) conceptDatatype.getConceptDatatypeId()); }
/** * @see DelegatingCrudResource#getByUniqueId(java.lang.String) */ @Override public ConceptDatatype getByUniqueId(String uuid) { ConceptDatatype datatype = Context.getConceptService().getConceptDatatypeByUuid(uuid); if (datatype == null) datatype = Context.getConceptService().getConceptDatatypeByName(uuid); return datatype; }
@Override public ConceptDatatype newObject() { return Context.getConceptService().getConceptDatatypeByUuid(getUuidProperty()); }
@Test public void shouldGetAConceptDatatypeByUuid() throws Exception { MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + getUuid()); SimpleObject result = deserialize(handle(req)); ConceptDatatype conceptDataType = service.getConceptDatatypeByUuid(getUuid()); Assert.assertEquals(conceptDataType.getUuid(), PropertyUtils.getProperty(result, "uuid")); Assert.assertEquals(conceptDataType.getName(), PropertyUtils.getProperty(result, "name")); }
@Test public void shouldGetAConceptDatatypeByUuid() throws Exception { MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + getUuid()); SimpleObject result = deserialize(handle(req)); ConceptDatatype conceptDataType = service.getConceptDatatypeByUuid(getUuid()); Assert.assertEquals(conceptDataType.getUuid(), PropertyUtils.getProperty(result, "uuid")); Assert.assertEquals(conceptDataType.getName(), PropertyUtils.getProperty(result, "name")); }