I have a service class that I would like to perform the integration test (whitebox). The method code,
@Async( ELLA_THREAD_POOL_EXECUTOR_NAME )
public void invokeEllaAsync( final IrisBo irisBo ) {
if( isTrafficAllowed( irisBo ) ) {
callEllaService( irisBo );
}
}
public void callEllaService( final IrisBo irisBo ) {
HttpHeaders ellaHeaders = createRequestHeaders( irisBo );
ServiceResponse<EllaResponseDto> response = connector.call( EllaDtoConverter.convertToRequest( irisBo ), ellaHeaders );
if( !response.isSuccess() ) {
LOG.error( "ERROR", response, irisBo );
}
}
The method that test is provided below,
@Test
public void testCallEllaServiceIsSuccessful() throws IOException {
String emailAgeResponseJson = readFile( ELLA_RESPONSE_FILE );
wireMockRule.stubFor( post( urlEqualTo( ELLA_ENDPOINT ) ).willReturn( okJson( emailAgeResponseJson ) ) );
TestRequestInformation testRequestInformation = new TestRequestInformation();
IrisBo irisBo = EllaTestDataProvider.createValidIrisBoWithoutRequest();
service.callEllaService( irisBo );
}
I would like to validate the response data, The method invokeEllaAsync
returns void
. The response is inside the method callEllaService
.
How do I validate the response data?