diff --git a/src/test/java/edu/harvard/dbmi/avillach/dictionary/concept/ConceptRepositoryTest.java b/src/test/java/edu/harvard/dbmi/avillach/dictionary/concept/ConceptRepositoryTest.java index f371012..ee55640 100644 --- a/src/test/java/edu/harvard/dbmi/avillach/dictionary/concept/ConceptRepositoryTest.java +++ b/src/test/java/edu/harvard/dbmi/avillach/dictionary/concept/ConceptRepositoryTest.java @@ -6,6 +6,7 @@ import edu.harvard.dbmi.avillach.dictionary.concept.model.ContinuousConcept; import edu.harvard.dbmi.avillach.dictionary.facet.Facet; import edu.harvard.dbmi.avillach.dictionary.filter.Filter; +import edu.harvard.dbmi.avillach.dictionary.legacysearch.model.SearchResult; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -323,4 +324,37 @@ void shouldGetContConceptWithDecimalNotation() { Assertions.assertEquals(0.57f, concept.min()); Assertions.assertEquals(6.77f, concept.max()); } + + @Test + void shouldGetLegacySearchResults() { + List searchResults = subject.getLegacySearchResults(new Filter(List.of(), "", List.of()), Pageable.unpaged()); + + Assertions.assertEquals(30, searchResults.size()); + } + + @Test + void shouldGetLegacySearchResultsBySearch() { + List searchResults = + subject.getLegacySearchResults(new Filter(List.of(), "phs000007", List.of()), Pageable.unpaged()); + + searchResults.forEach(searchResult -> Assertions.assertEquals("phs000007", searchResult.result().studyId())); + + } + + @Test + void shouldGetLegacySearchResultsByPageSize() { + List searchResults = subject.getLegacySearchResults(new Filter(List.of(), "", List.of()), Pageable.ofSize(5)); + + Assertions.assertEquals(5, searchResults.size()); + } + + @Test + void legacySearchResultShouldGetEqualCountToConceptSearch() { + // This test will ensure modifications made to the conceptSearch will be reflected in the legacy search result. + // They use near equivalent queries and updates made to one should be made to the other. + List searchResults = subject.getLegacySearchResults(new Filter(List.of(), "", List.of()), Pageable.unpaged()); + List concepts = subject.getConcepts(new Filter(List.of(), "", List.of()), Pageable.unpaged()); + + Assertions.assertEquals(searchResults.size(), concepts.size()); + } }