1 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 45 public class TestEquals extends TestCase { 46 47 public static Test suite() { 48 return new TestSuite(TestEquals.class); 49 } 50 51 54 public TestEquals() { 55 super(); 56 } 57 58 61 public TestEquals(String 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 |