Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAT-7929: Fixing conditional that wasn't checking for model/version m… #26

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public String getLibraryCql(String name, String version, String accessToken) {

UsingProperties libraryUsing = new CqlTextParser(responseEntity.getBody()).getUsing();
if (libraryUsing.getLine().equals(MadieLibrarySourceProvider.getUsingProperties().getLine())
|| supportedLibraries.contains(libraryUsing.getLibraryType())) {
&& supportedLibraries.contains(libraryUsing.getLibraryType())) {
return responseEntity.getBody();
}
log.error("Library model and version does not match the Measure model and version");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void getLibraryCql() {
}

@Test
void getLibraryCqlThrowCqlIncludeException() {
void getLibraryCqlWrongModelThrowCqlIncludeException() {
String cql =
"library QICoreCommon version '1.3.000'\n"
+ "using QICore version '4.1.1'\n"
Expand All @@ -97,6 +97,46 @@ void getLibraryCqlThrowCqlIncludeException() {
() -> cqlLibraryService.getLibraryCql(cqlLibraryName, cqlLibraryVersion, accessToken));
}

@Test
void getLibraryCqlWrongVersionThrowCqlIncludeException() {
String cql =
"library QICoreCommon version '1.3.000'\n"
+ "using QICore version '4.1.1'\n"
+ "Response Cql String";
cqlLibraryService.setUpLibrarySourceProvider(cql, "ACCESS_TOKEN");

String wrongLibrarycql =
"library QICoreCommon version '1.3.000'\n"
+ "using QICore version '6.0.0'\n"
+ "Response Cql String";
when(restTemplate.exchange(
libraryUri, HttpMethod.GET, new HttpEntity<>(httpHeaders), String.class))
.thenReturn(new ResponseEntity<>(wrongLibrarycql, HttpStatus.OK));
assertThrows(
CqlIncludeException.class,
() -> cqlLibraryService.getLibraryCql(cqlLibraryName, cqlLibraryVersion, accessToken));
}

@Test
void getLibraryCqlWrongModelAndVersionThrowCqlIncludeException() {
String cql =
"library QICoreCommon version '1.3.000'\n"
+ "using QICore version '4.1.1'\n"
+ "Response Cql String";
cqlLibraryService.setUpLibrarySourceProvider(cql, "ACCESS_TOKEN");

String wrongLibrarycql =
"library QICoreCommon version '1.3.000'\n"
+ "using FHIR version '4.0.1'\n"
+ "Response Cql String";
when(restTemplate.exchange(
libraryUri, HttpMethod.GET, new HttpEntity<>(httpHeaders), String.class))
.thenReturn(new ResponseEntity<>(wrongLibrarycql, HttpStatus.OK));
assertThrows(
CqlIncludeException.class,
() -> cqlLibraryService.getLibraryCql(cqlLibraryName, cqlLibraryVersion, accessToken));
}

@Test
void getLibraryCqlReturnsNull() {
when(restTemplate.exchange(
Expand Down
Loading