Search in sources :

Example 21 with ResponseEntity

use of com.tvd12.ezyhttp.core.response.ResponseEntity in project ezyhttp by youngmonkeys.

the class ResponseEntityTest method createByOk.

@Test
public void createByOk() {
    // given
    // when
    ResponseEntity sut = ResponseEntity.ok();
    // then
    Asserts.assertEquals(StatusCodes.OK, sut.getStatus());
}
Also used : ResponseEntity(com.tvd12.ezyhttp.core.response.ResponseEntity) Test(org.testng.annotations.Test)

Example 22 with ResponseEntity

use of com.tvd12.ezyhttp.core.response.ResponseEntity in project ezyhttp by youngmonkeys.

the class ResponseEntityTest method createByStatusHeadersAndBody2.

@Test
public void createByStatusHeadersAndBody2() {
    // given
    int status = StatusCodes.ACCEPTED;
    Object body = "Hello World";
    // when
    ResponseEntity sut = ResponseEntity.create(status, body);
    // then
    Asserts.assertEquals(status, sut.getStatus());
    Asserts.assertEquals(body, sut.getBody());
}
Also used : ResponseEntity(com.tvd12.ezyhttp.core.response.ResponseEntity) Test(org.testng.annotations.Test)

Example 23 with ResponseEntity

use of com.tvd12.ezyhttp.core.response.ResponseEntity in project ezyhttp by youngmonkeys.

the class ResponseEntityTest method createByNotFound.

@Test
public void createByNotFound() {
    // given
    // when
    ResponseEntity sut = ResponseEntity.notFound();
    // then
    Asserts.assertEquals(StatusCodes.NOT_FOUND, sut.getStatus());
}
Also used : ResponseEntity(com.tvd12.ezyhttp.core.response.ResponseEntity) Test(org.testng.annotations.Test)

Example 24 with ResponseEntity

use of com.tvd12.ezyhttp.core.response.ResponseEntity in project ezyhttp by youngmonkeys.

the class ResponseEntityTest method createByStatus.

@Test
public void createByStatus() {
    // given
    int status = StatusCodes.ACCEPTED;
    // when
    ResponseEntity sut = ResponseEntity.status(status).build();
    // then
    Asserts.assertEquals(status, sut.getStatus());
}
Also used : ResponseEntity(com.tvd12.ezyhttp.core.response.ResponseEntity) Test(org.testng.annotations.Test)

Example 25 with ResponseEntity

use of com.tvd12.ezyhttp.core.response.ResponseEntity in project ezyhttp by youngmonkeys.

the class ResponseEntityTest method noContentTest.

@Test
public void noContentTest() {
    // given
    // when
    ResponseEntity sut = ResponseEntity.noContent();
    // then
    Asserts.assertEquals(StatusCodes.NO_CONTENT, sut.getStatus());
}
Also used : ResponseEntity(com.tvd12.ezyhttp.core.response.ResponseEntity) Test(org.testng.annotations.Test)

Aggregations

ResponseEntity (com.tvd12.ezyhttp.core.response.ResponseEntity)24 Test (org.testng.annotations.Test)21 ClientNotActiveException (com.tvd12.ezyhttp.client.exception.ClientNotActiveException)6 RequestQueueFullException (com.tvd12.ezyhttp.client.exception.RequestQueueFullException)6 UnhandledErrorHandler (com.tvd12.ezyhttp.server.core.handler.UnhandledErrorHandler)4 HttpServletRequest (javax.servlet.http.HttpServletRequest)4 HttpServletResponse (javax.servlet.http.HttpServletResponse)4 EzyFuture (com.tvd12.ezyfox.concurrent.EzyFuture)3 BadRequestException (com.tvd12.ezyfox.exception.BadRequestException)3 EzyProcessor.processWithException (com.tvd12.ezyfox.util.EzyProcessor.processWithException)3 HttpClientProxy (com.tvd12.ezyhttp.client.HttpClientProxy)3 DownloadCancelledException (com.tvd12.ezyhttp.client.exception.DownloadCancelledException)3 MultiValueMap (com.tvd12.ezyhttp.core.data.MultiValueMap)3 ComponentManager (com.tvd12.ezyhttp.server.core.manager.ComponentManager)3 BlockingServlet (com.tvd12.ezyhttp.server.core.servlet.BlockingServlet)3 BaseTest (com.tvd12.test.base.BaseTest)3 IOException (java.io.IOException)3 UnknownHostException (java.net.UnknownHostException)3 ServletOutputStream (javax.servlet.ServletOutputStream)3 ToString (lombok.ToString)3