KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > httpclient > TestEquals


1 /*
2  * $Header: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestEquals.java,v 1.1.2.2 2004/02/22 18:21:16 olegk Exp $
3  * $Revision: 1.1.2.2 $
4  * $Date: 2004/02/22 18:21:16 $
5  *
6  * ====================================================================
7  *
8  * Copyright 2002-2004 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  * ====================================================================
22  *
23  * This software consists of voluntary contributions made by many
24  * individuals on behalf of the Apache Software Foundation. For more
25  * information on the Apache Software Foundation, please see
26  * <http://www.apache.org/>.
27  *
28  * [Additional notices, if required by prior licensing conditions]
29  *
30  */

31  
32  package org.apache.commons.httpclient;
33
34 import junit.framework.Test;
35 import junit.framework.TestCase;
36 import junit.framework.TestSuite;
37
38 import org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory;
39 import org.apache.commons.httpclient.protocol.Protocol;
40 import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
41 import org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory;
42
43 /**
44  */

45 public class TestEquals extends TestCase {
46     
47     public static Test suite() {
48         return new TestSuite(TestEquals.class);
49     }
50     
51     /**
52      *
53      */

54     public TestEquals() {
55         super();
56     }
57
58     /**
59      * @param arg0
60      */

61     public TestEquals(String JavaDoc arg0) {
62         super(arg0);
63     }
64
65     public void testProtocol() {
66         
67         Protocol p1 = new Protocol("test", new DefaultProtocolSocketFactory(), 123);
68         Protocol p2 = new Protocol("test", new DefaultProtocolSocketFactory(), 123);
69         
70         assertTrue(p1.equals(p2));
71         assertTrue(p2.equals(p1));
72     }
73     
74     public void testProtocolSocketFactory() {
75         
76         ProtocolSocketFactory p1 = new DefaultProtocolSocketFactory();
77         ProtocolSocketFactory p2 = new DefaultProtocolSocketFactory();
78
79         assertTrue(p1.equals(p2));
80         assertTrue(p2.equals(p1));
81
82         p1 = new SSLProtocolSocketFactory();
83         p2 = new SSLProtocolSocketFactory();
84
85         assertTrue(p1.equals(p2));
86         assertTrue(p2.equals(p1));
87         
88     }
89     
90     public void testHostConfiguration() {
91         
92         HostConfiguration hc1 = new HostConfiguration();
93         hc1.setHost("http", 80, "http");
94
95         HostConfiguration hc2 = new HostConfiguration();
96         hc2.setHost("http", 80, "http");
97
98         assertTrue(hc1.equals(hc2));
99         assertTrue(hc2.equals(hc1));
100     }
101     
102 }
103
Popular Tags