FHIR Chat · unit testing fluent hapi client · hapi

Stream: hapi

Topic: unit testing fluent hapi client


view this post on Zulip Luca Toldo (Jan 16 2020 at 10:38):

Dear all,
I am trying to mock the fluent hapi client, using mockito, and I was wondering if others have done it already and could share experiences.
Thanks

view this post on Zulip Noemi Deppenwiese (Jan 16 2020 at 10:42):

Mockito provides functionality for deep stubs e.g.

 @Mock(answer = Answers.RETURNS_DEEP_STUBS)
    private IGenericClient fhirClient;

which allows for mocking methods like this

when(fhirClient.update().resource(resource).execute()).thenReturn(answer);

view this post on Zulip Luca Toldo (Jan 16 2020 at 10:57):

@Noemi Deppenwiese thankyou,


Last updated: Apr 12 2022 at 19:14 UTC