2 * Copyright 2017 ZTE Corporation.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
14 package org.onap.msb.sdk.httpclient.conf;
16 import java.util.HashSet;
19 import org.junit.Assert;
20 import org.junit.Test;
22 public class HttpClientConfTest {
25 public void testEquals() {
26 HttpClientConf conf1 = new HttpClientConf();
27 conf1.setConnectTimeout(100000);
28 conf1.setReadTimeout(200000);
29 conf1.setWriteTimeout(30000);
31 HttpClientConf conf2 = new HttpClientConf();
32 conf2.setConnectTimeout(100000);
33 conf2.setReadTimeout(200000);
34 conf2.setWriteTimeout(30000);
36 Assert.assertEquals(conf1, conf2);
38 conf2.setWriteTimeout(10000);
39 Assert.assertNotEquals(conf1, conf2);
43 public void testHashCode() {
44 HttpClientConf conf1 = new HttpClientConf();
45 conf1.setConnectTimeout(100000);
46 conf1.setReadTimeout(200000);
47 conf1.setWriteTimeout(30000);
49 HttpClientConf conf2 = new HttpClientConf();
50 conf2.setConnectTimeout(100000);
51 conf2.setReadTimeout(200000);
52 conf2.setWriteTimeout(30000);
54 Set set = new HashSet();
58 Assert.assertEquals(set.size(), 1);
60 HttpClientConf conf3 = new HttpClientConf();
61 conf3.setConnectTimeout(100000);
62 conf3.setReadTimeout(200000);
63 conf3.setWriteTimeout(10000);
65 Assert.assertEquals(set.size(), 2);