Update rest-client with additional operations
[aai/rest-client.git] / src / test / java / org / openecomp / restclient / rest / HttpUtilTest.java
1 package org.openecomp.restclient.rest;
2
3 import static org.junit.Assert.assertFalse;
4 import static org.junit.Assert.assertTrue;
5
6 import org.junit.Before;
7 import org.junit.Test;
8
9 public class HttpUtilTest {
10
11   /**
12    * Test case initialization
13    * 
14    * @throws Exception the exception
15    */
16   @Before
17   public void init() throws Exception {
18   }
19   
20   @Test
21   public void validateAccesors() {
22     
23     assertFalse(HttpUtil.isHttpResponseClassInformational(-1));
24     assertFalse(HttpUtil.isHttpResponseClassInformational(99));
25     assertTrue(HttpUtil.isHttpResponseClassInformational(183));
26     assertFalse(HttpUtil.isHttpResponseClassInformational(200));
27
28     assertFalse(HttpUtil.isHttpResponseClassSuccess(199));
29     assertTrue(HttpUtil.isHttpResponseClassSuccess(202));
30     assertFalse(HttpUtil.isHttpResponseClassSuccess(300));
31
32     assertFalse(HttpUtil.isHttpResponseClassRedirection(299));
33     assertTrue(HttpUtil.isHttpResponseClassRedirection(307));
34     assertFalse(HttpUtil.isHttpResponseClassRedirection(401));
35
36     assertFalse(HttpUtil.isHttpResponseClassClientError(399));
37     assertTrue(HttpUtil.isHttpResponseClassClientError(404));
38     assertFalse(HttpUtil.isHttpResponseClassClientError(555));
39
40     assertFalse(HttpUtil.isHttpResponseClassServerError(499));
41     assertTrue(HttpUtil.isHttpResponseClassServerError(504));
42     assertFalse(HttpUtil.isHttpResponseClassServerError(662));
43     
44     int[] successCodes = { 201, 202, 205, 299 };
45     
46     assertTrue(HttpUtil.isHttpResponseInList(201, successCodes));
47     assertFalse(HttpUtil.isHttpResponseInList(301, successCodes));
48     
49   }
50     
51 }