/** * @see {@link HtmlFormEntryUtil#getConcept(String)} tests a uuid that is in invalid format (less * than 36 characters) */ @Test @Verifies(value = "should not find a concept with invalid uuid", method = "getConcept(String)") public void getConcept_shouldNotFindAConceptWithInvalidUuid() throws Exception { // concept from HtmlFormEntryTest-data.xml String id = "1000"; Assert.assertNull(HtmlFormEntryUtil.getConcept(id)); }
/** * @see {@link HtmlFormEntryUtil#getConcept(String)} tests a uuid that is 36 characters long but * has no dashes */ @Test @Verifies(value = "should find a concept by its uuid", method = "getConcept(String)") public void getConcept_shouldFindAConceptWithNonStandardUuid() throws Exception { // concept from HtmlFormEntryTest-data.xml String id = "1000AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; Assert.assertEquals(id, HtmlFormEntryUtil.getConcept(id).getUuid()); }
/** @see {@link HtmlFormEntryUtil#getConcept(String)} this is the uuid test */ @Test @Verifies(value = "should find a concept by its uuid", method = "getConcept(String)") public void getConcept_shouldFindAConceptByItsUuid() throws Exception { // the uuid from standardTestDataset String id = "0cbe2ed3-cd5f-4f46-9459-26127c9265ab"; Assert.assertEquals(id, HtmlFormEntryUtil.getConcept(id).getUuid()); }
/** @see {@link HtmlFormEntryUtil#getConcept(String)} mapping test */ @Test @Verifies(value = "should find a concept by its mapping", method = "getConcept(String)") public void getConcept_shouldFindAConceptByItsMapping() throws Exception { String id = "XYZ:HT"; Concept cpt = HtmlFormEntryUtil.getConcept(id); Assert.assertEquals("XYZ", cpt.getConceptMappings().iterator().next().getSource().getName()); Assert.assertEquals("HT", cpt.getConceptMappings().iterator().next().getSourceCode()); }
/** @see {@link HtmlFormEntryUtil#getConcept(String)} */ @Test @Verifies(value = "should return null otherwise", method = "getConcept(String)") public void getConcept_shouldReturnNullOtherwise() throws Exception { String id = null; Assert.assertNull(HtmlFormEntryUtil.getConcept(id)); id = ""; Assert.assertNull(HtmlFormEntryUtil.getConcept(id)); id = "100000"; // not exist in the standardTestData Assert.assertNull(HtmlFormEntryUtil.getConcept(id)); id = "ASDFASDFEAF"; // random string Assert.assertNull(HtmlFormEntryUtil.getConcept(id)); id = ":"; // mapping style Assert.assertNull(HtmlFormEntryUtil.getConcept(id)); id = "-"; // uuid style Assert.assertNull(HtmlFormEntryUtil.getConcept(id)); }
/** @see {@link HtmlFormEntryUtil#getConcept(String)} id test */ @Test @Verifies(value = "should find a concept by its conceptId", method = "getConcept(String)") public void getConcept_shouldFindAConceptByItsConceptId() throws Exception { String id = "3"; Assert.assertEquals("3", HtmlFormEntryUtil.getConcept(id).getConceptId().toString()); }