Search in sources :

Example 6 with StatusType

use of javax.ws.rs.core.Response.StatusType in project java-chassis by ServiceComb.

the class TestHttpStatusManager method test.

@Test
public void test() {
    HttpStatusManager mgr = new HttpStatusManager();
    StatusType st = mgr.getOrCreateByStatusCode(200);
    Assert.assertEquals(200, st.getStatusCode());
    st = mgr.getOrCreateByStatusCode(250);
    Assert.assertEquals(250, st.getStatusCode());
    try {
        mgr.addStatusType(new HttpStatus(250, "250"));
        throw new Error("not allowed");
    } catch (Throwable e) {
        Assert.assertEquals("repeated status code: 250", e.getMessage());
    }
}
Also used : StatusType(javax.ws.rs.core.Response.StatusType) Test(org.junit.Test)

Aggregations

StatusType (javax.ws.rs.core.Response.StatusType)6 HttpStatus (io.servicecomb.core.context.HttpStatus)2 Test (org.junit.Test)2 Response (io.servicecomb.core.Response)1 Headers (io.servicecomb.swagger.invocation.response.Headers)1 List (java.util.List)1 Status (javax.ws.rs.core.Response.Status)1 HttpHeaders (org.springframework.http.HttpHeaders)1 ResponseEntity (org.springframework.http.ResponseEntity)1