/** * @see ConceptService#retireConceptMapType(ConceptMapType,String) */ @Test public void retireConceptMapType_shouldShouldSetTheDefaultRetireReasonIfNoneIsGiven() { //sanity check ConceptMapType mapType = Context.getConceptService().getConceptMapType(1); Assert.assertNull(mapType.getRetireReason()); ConceptMapType retiredMapType = Context.getConceptService().retireConceptMapType(mapType, null); Assert.assertNotNull(retiredMapType.getRetireReason()); }
/** * @see ConceptService#retireConceptMapType(ConceptMapType,String) */ @Test public void retireConceptMapType_shouldRetireTheSpecifiedConceptMapTypeWithTheGivenRetireReason() { ConceptMapType mapType = Context.getConceptService().getConceptMapType(1); Assert.assertFalse(mapType.getRetired()); Assert.assertNull(mapType.getRetiredBy()); Assert.assertNull(mapType.getDateRetired()); Assert.assertNull(mapType.getRetireReason()); ConceptMapType retiredMapType = Context.getConceptService().retireConceptMapType(mapType, "test retire reason"); Assert.assertTrue(retiredMapType.getRetired()); Assert.assertEquals(retiredMapType.getRetireReason(), "test retire reason"); Assert.assertNotNull(retiredMapType.getRetiredBy()); Assert.assertNotNull(retiredMapType.getDateRetired()); }
/** * @see ConceptService#unretireConceptMapType(ConceptMapType) */ @Test public void unretireConceptMapType_shouldUnretireTheSpecifiedConceptMapTypeAndDropAllRetireRelatedFields() { ConceptMapType mapType = Context.getConceptService().getConceptMapType(6); Assert.assertTrue(mapType.getRetired()); Assert.assertNotNull(mapType.getRetiredBy()); Assert.assertNotNull(mapType.getDateRetired()); Assert.assertNotNull(mapType.getRetireReason()); ConceptMapType unRetiredMapType = Context.getConceptService().unretireConceptMapType(mapType); Assert.assertFalse(unRetiredMapType.getRetired()); Assert.assertNull(unRetiredMapType.getRetireReason()); Assert.assertNull(unRetiredMapType.getRetiredBy()); Assert.assertNull(unRetiredMapType.getDateRetired()); }
@Test public void shouldRetireAConceptMapType() throws Exception { assertEquals(false, service.getConceptMapTypeByUuid(getUuid()).isRetired()); MockHttpServletRequest req = request(RequestMethod.DELETE, getURI() + "/" + getUuid()); req.addParameter("!purge", ""); final String reason = "none"; req.addParameter("reason", reason); handle(req); assertEquals(true, service.getConceptMapTypeByUuid(getUuid()).isRetired()); assertEquals(reason, service.getConceptMapTypeByUuid(getUuid()).getRetireReason()); }