Skip to content

Commit

Permalink
Restore and fix failing SimpleWorkerContextTests (hapifhir#1557)
Browse files Browse the repository at this point in the history
* Restore and fix failing tests

* Bump test cases version

* Use released test cases
  • Loading branch information
dotasek authored Feb 1, 2024
1 parent 3a1946e commit af43ce9
Showing 1 changed file with 29 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public void testExpandValueSetWithClient() throws IOException {

ValueSetExpansionOutcome actualExpansionResult = context.expandVS(inc, true, false);

// assertEquals(expectedValueSet, actualExpansionResult.getValueset());
assertEquals(expectedValueSet, actualExpansionResult.getValueset());

Mockito.verify(terminologyCache).getExpansion(cacheToken);
Mockito.verify(terminologyCache).cacheExpansion(cacheToken, actualExpansionResult,true);
Expand Down Expand Up @@ -412,7 +412,7 @@ public void testExpandValueSet4ArgsWithClient() throws IOException {

ValueSetExpansionOutcome actualExpansionResult = context.expandVS(vs, true, true, true, pIn, false);

// assertEquals(expectedValueSet, actualExpansionResult.getValueset());
assertEquals(expectedValueSet, actualExpansionResult.getValueset());

Mockito.verify(terminologyCache).getExpansion(cacheToken);
Mockito.verify(terminologyCache).cacheExpansion(cacheToken, actualExpansionResult, true);
Expand All @@ -421,40 +421,37 @@ public void testExpandValueSet4ArgsWithClient() throws IOException {

@Test
public void testInitializationWithCache() {
// String address = "/...";
//
// Mockito.doReturn(true).when(terminologyCache).hasTerminologyCapabilities(address);
//// Mockito.doReturn(true).when(terminologyCache).hasCapabilityStatement();
//
// Mockito.doReturn(terminologyCapabilities).when(terminologyCache).getTerminologyCapabilities(address);
//// Mockito.doReturn(capabilitiesStatement).when(terminologyCache).getCapabilityStatement();
//
// context.connectToTSServer(new TerminologyClientR5Factory(), terminologyClient);
//
// Mockito.verify(terminologyCache).getTerminologyCapabilities(address);
// Mockito.verify(terminologyClient).getCapabilitiesStatementQuick();
//
// Mockito.verify(terminologyCache, times(0)).getCapabilityStatement(address);
// Mockito.verify(terminologyClient, times(0)).getTerminologyCapabilities();
String address = "dummyUrl";

Mockito.doReturn(true).when(terminologyCache).hasTerminologyCapabilities(address);

Mockito.doReturn(terminologyCapabilities).when(terminologyCache).getTerminologyCapabilities(address);

context.connectToTSServer(new TerminologyClientR5Factory(), terminologyClient);

Mockito.verify(terminologyCache).getTerminologyCapabilities(address);
Mockito.verify(terminologyClient).getCapabilitiesStatementQuick();

Mockito.verify(terminologyCache, times(0)).getCapabilityStatement(address);
Mockito.verify(terminologyClient, times(0)).getTerminologyCapabilities();
}

@Test
public void testInitializationWithClient() {
// String address = "/...";
//
// Mockito.doReturn(false).when(terminologyCache).hasTerminologyCapabilities(address);
//// Mockito.doReturn(false).when(terminologyCache).hasCapabilityStatement();
//
// Mockito.doReturn(terminologyCapabilities).when(terminologyClient).getTerminologyCapabilities();
// Mockito.doReturn(capabilitiesStatement).when(terminologyClient).getCapabilitiesStatementQuick();
//
// context.connectToTSServer(new TerminologyClientR5Factory(), terminologyClient);
//
// Mockito.verify(terminologyCache, times(0)).getTerminologyCapabilities(address);
// Mockito.verify(terminologyCache, times(0)).getCapabilityStatement(address);
//
// Mockito.verify(terminologyClient).getTerminologyCapabilities();
// Mockito.verify(terminologyClient).getCapabilitiesStatementQuick();
String address = "dummyUrl";

Mockito.doReturn(false).when(terminologyCache).hasTerminologyCapabilities(address);

Mockito.doReturn(terminologyCapabilities).when(terminologyClient).getTerminologyCapabilities();
Mockito.doReturn(capabilitiesStatement).when(terminologyClient).getCapabilitiesStatementQuick();

context.connectToTSServer(new TerminologyClientR5Factory(), terminologyClient);

Mockito.verify(terminologyCache, times(0)).getTerminologyCapabilities(address);
Mockito.verify(terminologyCache, times(0)).getCapabilityStatement(address);

Mockito.verify(terminologyClient).getTerminologyCapabilities();
Mockito.verify(terminologyClient).getCapabilitiesStatementQuick();

}

Expand Down

0 comments on commit af43ce9

Please sign in to comment.