From 19022393be0994be1760d28a40887c5e1091e22f Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Fri, 10 Dec 2010 22:38:10 +0000 Subject: [PATCH] Add some more tests for equals git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1044524 13f79535-47bb-0310-9956-ffa450edef68 --- .../http/conn/routing/TestRouteTracker.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/httpclient/src/test/java/org/apache/http/conn/routing/TestRouteTracker.java b/httpclient/src/test/java/org/apache/http/conn/routing/TestRouteTracker.java index 8615b86d1..c6daeb942 100644 --- a/httpclient/src/test/java/org/apache/http/conn/routing/TestRouteTracker.java +++ b/httpclient/src/test/java/org/apache/http/conn/routing/TestRouteTracker.java @@ -372,6 +372,9 @@ public class TestRouteTracker { throws CloneNotSupportedException { RouteTracker rt0 = new RouteTracker(TARGET1, null); + RouteTracker rt1 = new RouteTracker(TARGET2, null); + RouteTracker rt2 = new RouteTracker(TARGET1, null); + RouteTracker rt3 = new RouteTracker(TARGET1, null); RouteTracker rt4 = new RouteTracker(TARGET1, LOCAL41); RouteTracker rt6 = new RouteTracker(TARGET1, LOCAL62); @@ -380,6 +383,20 @@ public class TestRouteTracker { Assert.assertFalse("rt0", rt0.equals(rt0.toString())); Assert.assertFalse("rt0 == rt4", rt0.equals(rt4)); + Assert.assertFalse("rt0 == rt1", rt0.equals(rt1)); // Check host takes part in equals + + // Check that connection takes part in equals + Assert.assertTrue("rt0 != rt2", rt0.equals(rt2)); + rt2.connectTarget(false); + Assert.assertFalse("rt0 == rt2", rt0.equals(rt2)); + + Assert.assertTrue("rt0 != rt3", rt0.equals(rt3)); + rt3.connectTarget(true); + Assert.assertFalse("rt0 == rt3", rt0.equals(rt3)); + Assert.assertFalse("rt2 == rt3", rt2.equals(rt3)); // Test secure takes part + + // TODO needs tests for tunnel and layered + Assert.assertFalse("rt4 == rt0", rt4.equals(rt0)); Assert.assertFalse("rt0 == rt6", rt0.equals(rt6)); Assert.assertFalse("rt6 == rt0", rt6.equals(rt0));