Skip to content

Commit

Permalink
#382 - Change display and translations structure for criteria and con…
Browse files Browse the repository at this point in the history
…cepts

- fix TerminologyRestControllerIT
  • Loading branch information
michael-82 committed Jan 15, 2025
1 parent 386af3b commit 35da68a
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public void testGetCriteriaProfileData_succeedsWith200() throws Exception {
var id = UUID.randomUUID();
var criteriaProfileDataList = createCriteriaProfileDataList(List.of(id));
doReturn(criteriaProfileDataList).when(terminologyService).getCriteriaProfileData(anyList());
doReturn(List.of(createDummyEsSearchResultEntry(id.toString()))).when(terminologyEsService).getSearchResultEntriesByHash(anyList());
doReturn(criteriaProfileDataList).when(terminologyService).addDisplayDataToCriteriaProfileData(anyList(), anyList());

mockMvc.perform(get(URI.create(PATH_API + PATH_TERMINOLOGY + "/criteria-profile-data")).param("ids", id.toString()).with(csrf()))
.andExpect(status().isOk())
Expand Down Expand Up @@ -179,7 +181,7 @@ public void testGetOntologyItemRelationsByHash_failsOnUnauthorized() throws Exce
@Test
@WithMockUser(roles = "DATAPORTAL_TEST_USER")
public void testGetOntologyItemByHash_succeeds() throws Exception {
var dummySearchResultEntry = createDummyEsSearchResultEntry();
var dummySearchResultEntry = createDummyEsSearchResultEntry("abc-123");
doReturn(dummySearchResultEntry).when(terminologyEsService).getSearchResultEntryByHash(any(String.class));

mockMvc.perform(get(URI.create(PATH_API + PATH_TERMINOLOGY + "/entry/abc")).with(csrf()))
Expand All @@ -196,7 +198,7 @@ public void testGetOntologyItemByHash_succeeds() throws Exception {

@Test
public void testGetOntologyItemByHash_failsOnUnauthorized() throws Exception {
var dummySearchResultEntry = createDummyEsSearchResultEntry();
var dummySearchResultEntry = createDummyEsSearchResultEntry("abc-123");
doReturn(dummySearchResultEntry).when(terminologyEsService).getSearchResultEntryByHash(any(String.class));

mockMvc.perform(get(URI.create(PATH_API + PATH_TERMINOLOGY + "/entry/abc")).with(csrf()))
Expand Down Expand Up @@ -255,16 +257,16 @@ private List<CriteriaProfileData> createCriteriaProfileDataList(List<UUID> ids)
private EsSearchResult createDummyEsSearchResult(int totalHits) {
return EsSearchResult.builder()
.totalHits(totalHits)
.results(List.of(createDummyEsSearchResultEntry()))
.results(List.of(createDummyEsSearchResultEntry("abc-123")))
.build();
}

private EsSearchResultEntry createDummyEsSearchResultEntry() {
private EsSearchResultEntry createDummyEsSearchResultEntry(String id) {
return EsSearchResultEntry.builder()
.terminology("some-terminology")
.availability(100)
.context("some-context")
.id("abc-123")
.id(id)
.kdsModule("some-module")
.display(createDummyDisplayEntry())
.selectable(true)
Expand Down

0 comments on commit 35da68a

Please sign in to comment.