use of com.dtflys.forest.reflection.NoneLifeCycleHandler in project forest by dromara.
the class TestResponseFactory method testHttpclientForestResponseFactory.
@Test
public void testHttpclientForestResponseFactory() {
ForestRequest request = new ForestRequest(ForestConfiguration.configuration());
Date requestTime = new Date();
HttpclientForestResponseFactory responseFactory = new HttpclientForestResponseFactory();
HttpResponse httpResponse = mock(HttpResponse.class);
StatusLine statusLine = mock(StatusLine.class);
when(statusLine.getStatusCode()).thenReturn(200);
when(httpResponse.getStatusLine()).thenReturn(statusLine);
LifeCycleHandler lifeCycleHandler = new NoneLifeCycleHandler();
ForestResponse response = responseFactory.createResponse(request, httpResponse, lifeCycleHandler, null, requestTime);
assertThat(response).isNotNull().extracting(ForestResponse::getStatusCode, ForestResponse::getContent, ForestResponse::getResult).contains(200, "", null);
}
Aggregations