Search in sources :

Example 6 with HttpResponse

use of com.blade.mvc.http.HttpResponse in project blade by biezhi.

the class HttpResponseTest method testHeaders.

@Test
public void testHeaders() {
    Response mockResponse = mockHttpResponse(200);
    when(mockResponse.headers()).thenReturn(new HashMap<>());
    Response response = new HttpResponse(mockResponse);
    assertEquals(0, response.headers().size());
    response.header("a", "123");
    assertEquals(1, response.headers().size());
}
Also used : HttpResponse(com.blade.mvc.http.HttpResponse) Response(com.blade.mvc.http.Response) HttpResponse(com.blade.mvc.http.HttpResponse) Test(org.junit.Test)

Example 7 with HttpResponse

use of com.blade.mvc.http.HttpResponse in project blade by biezhi.

the class HttpResponseTest method testBadRequest.

@Test
public void testBadRequest() {
    Response mockResponse = mockHttpResponse(200);
    Response response = new HttpResponse(mockResponse);
    response.badRequest();
    assertEquals(400, response.statusCode());
}
Also used : HttpResponse(com.blade.mvc.http.HttpResponse) Response(com.blade.mvc.http.Response) HttpResponse(com.blade.mvc.http.HttpResponse) Test(org.junit.Test)

Aggregations

HttpResponse (com.blade.mvc.http.HttpResponse)7 Response (com.blade.mvc.http.Response)7 Test (org.junit.Test)7