Skip to content

Commit

Permalink
Merge branch 'master' into BAH-3893
Browse files Browse the repository at this point in the history
  • Loading branch information
mohan-13 committed Jun 4, 2024
2 parents 8371fb4 + 8697e05 commit d4b37df
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,21 @@ private static boolean isFullySpecifiedName(ConceptName conceptName) {
return ObjectUtils.equals(conceptName.getConceptNameType(), ConceptNameType.FULLY_SPECIFIED);
}

private static boolean containsClassName(String conceptClassName, List<String> classNames){
for (String className : classNames) {
if (className.equalsIgnoreCase(conceptClassName)) {
return true;
}
}
return false;
}

public static boolean isOfConceptClass(Concept concept, String conceptClassName) {
return concept.getConceptClass() != null && concept.getConceptClass().getName() != null && concept.getConceptClass().getName().equals(conceptClassName);
}

public static boolean isOfAnyConceptClass(Concept concept, List<String> conceptClassNames) {
return concept.getConceptClass() != null && concept.getConceptClass().getName() != null && conceptClassNames.contains(concept.getConceptClass().getName());
return concept.getConceptClass() != null && concept.getConceptClass().getName() != null && containsClassName(concept.getConceptClass().getName(),conceptClassNames);
}

public static boolean isOfConceptClassByUUID(Concept concept, String conceptClassUUID) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ public void createEventForTestEventIfConceptClassIsLabTestOrTest() throws Except
assertEquals(eventForTestConceptClass.getCategory(), ConceptServiceEventFactory.LAB);
}

@Test
public void shouldCreateEventForCaseInsensitiveConceptClassMatches() throws Exception {
Concept conceptWithClassLabTest = new ConceptBuilder().withClass("LabTest").withUUID(LAB_TEST_CONCEPT_UUID).build();
Concept conceptWithClasslabtest = new ConceptBuilder().withClass("labtest").withUUID("9b11d2d1-c7ea-40f7-8616-be9bec4c6b98").build();
Event eventForLabTestConceptClass = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{conceptWithClassLabTest}).get(0);
Event eventForlabtestConceptClass = new Operation(ConceptService.class.getMethod("saveConcept", Concept.class)).apply(new Object[]{conceptWithClasslabtest}).get(0);
assertNotNull(eventForLabTestConceptClass);
assertNotNull(eventForlabtestConceptClass);

}

@Test
public void shouldNotCreateEventForTestEventIfThereIsDifferentConceptClass() throws Exception {
conceptWithLabTestClass = new ConceptBuilder().withClassUUID("some").withClass("some").withUUID(TEST_CONCEPT_UUID).build();
Expand Down

0 comments on commit d4b37df

Please sign in to comment.