Skip to content

Commit

Permalink
[APHL-1326] comments
Browse files Browse the repository at this point in the history
  • Loading branch information
taha.attari@smilecdr.com committed Mar 7, 2025
1 parent 9ef83e5 commit f239e6c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ void packageVisitorShouldUseExpansionCacheIfProvided() {

@Test
void fallback_to_tx_server_if_valueset_missing_locally() {
// SpecificationLibrary - root is experimental but HAS experimental children
final var leafOid = "2.16.840.1.113762.1.4.1146.6";
final var authoritativeSource = "http://cts.nlm.nih.gov/fhir/";
var bundle = (Bundle) jsonParser.parseResource(
Expand All @@ -485,7 +484,7 @@ void fallback_to_tx_server_if_valueset_missing_locally() {
&& ((ValueSet) e.getResource()).getUrl().contains(leafOid);
// remove leaf from bundle
var leafEntry = bundle.getEntry().stream().filter(leafFinder).findFirst();
var leafVset = leafEntry.map(e -> (ValueSet) e.getResource()).get();
var missingVset = leafEntry.map(e -> (ValueSet) e.getResource()).get();
bundle.getEntry().remove(leafEntry.get());

repo.transaction(bundle);
Expand All @@ -494,7 +493,8 @@ void fallback_to_tx_server_if_valueset_missing_locally() {
var endpoint = createEndpoint(authoritativeSource);

var clientMock = mock(TerminologyServerClient.class, new ReturnsDeepStubs());
when(clientMock.getResource(any(IEndpointAdapter.class), any(), any())).thenReturn(Optional.of(leafVset));
// expect the Tx Server to provide the missing ValueSet
when(clientMock.getResource(any(IEndpointAdapter.class), any(), any())).thenReturn(Optional.of(missingVset));
doAnswer(new Answer<ValueSet>() {
@Override
public ValueSet answer(InvocationOnMock invocation) throws Throwable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ void packageVisitorShouldUseExpansionCacheIfProvided() {

@Test
void fallback_to_tx_server_if_valueset_missing_locally() {
// SpecificationLibrary - root is experimental but HAS experimental children
final var leafOid = "2.16.840.1.113762.1.4.1146.6";
final var authoritativeSource = "http://cts.nlm.nih.gov/fhir/";
var bundle = (Bundle) jsonParser.parseResource(
Expand All @@ -444,7 +443,7 @@ void fallback_to_tx_server_if_valueset_missing_locally() {
&& ((ValueSet) e.getResource()).getUrl().contains(leafOid);
// remove leaf from bundle
var leafEntry = bundle.getEntry().stream().filter(leafFinder).findFirst();
var leafVset = leafEntry.map(e -> (ValueSet) e.getResource()).get();
var missingVset = leafEntry.map(e -> (ValueSet) e.getResource()).get();
bundle.getEntry().remove(leafEntry.get());

repo.transaction(bundle);
Expand All @@ -453,7 +452,8 @@ void fallback_to_tx_server_if_valueset_missing_locally() {
var endpoint = createEndpoint(authoritativeSource);

var clientMock = mock(TerminologyServerClient.class, new ReturnsDeepStubs());
when(clientMock.getResource(any(IEndpointAdapter.class), any(), any())).thenReturn(Optional.of(leafVset));
// expect the Tx Server to provide the missing ValueSet
when(clientMock.getResource(any(IEndpointAdapter.class), any(), any())).thenReturn(Optional.of(missingVset));
doAnswer(new Answer<ValueSet>() {
@Override
public ValueSet answer(InvocationOnMock invocation) throws Throwable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ void packageVisitorShouldUseExpansionCacheIfProvided() {

@Test
void fallback_to_tx_server_if_valueset_missing_locally() {
// SpecificationLibrary - root is experimental but HAS experimental children
final var leafOid = "2.16.840.1.113762.1.4.1146.6";
final var authoritativeSource = "http://cts.nlm.nih.gov/fhir/";
var bundle = (Bundle) jsonParser.parseResource(
Expand All @@ -486,7 +485,7 @@ void fallback_to_tx_server_if_valueset_missing_locally() {
&& ((ValueSet) e.getResource()).getUrl().contains(leafOid);
// remove leaf from bundle
var leafEntry = bundle.getEntry().stream().filter(leafFinder).findFirst();
var leafVset = leafEntry.map(e -> (ValueSet) e.getResource()).get();
var missingVset = leafEntry.map(e -> (ValueSet) e.getResource()).get();
bundle.getEntry().remove(leafEntry.get());

repo.transaction(bundle);
Expand All @@ -495,7 +494,8 @@ void fallback_to_tx_server_if_valueset_missing_locally() {
var endpoint = createEndpoint(authoritativeSource);

var clientMock = mock(TerminologyServerClient.class, new ReturnsDeepStubs());
when(clientMock.getResource(any(IEndpointAdapter.class), any(), any())).thenReturn(Optional.of(leafVset));
// expect the Tx Server to provide the missing ValueSet
when(clientMock.getResource(any(IEndpointAdapter.class), any(), any())).thenReturn(Optional.of(missingVset));
doAnswer(new Answer<ValueSet>() {
@Override
public ValueSet answer(InvocationOnMock invocation) throws Throwable {
Expand Down

0 comments on commit f239e6c

Please sign in to comment.