first tests for route params

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@618122 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Roland Weber 2008-02-03 23:26:29 +00:00
parent 6963674cd6
commit 1892a783cc
4 changed files with 175 additions and 2 deletions

View File

@ -30,6 +30,7 @@
package org.apache.http.conn;
import org.apache.http.conn.params.TestAllConnParams;
import org.apache.http.conn.routing.TestAllRouting;
import org.apache.http.conn.ssl.TestAllSSL;
import org.apache.http.conn.util.TestAllUtil;
@ -48,8 +49,8 @@ public class TestAllConn extends TestCase {
TestSuite suite = new TestSuite();
suite.addTest(TestScheme.suite());
suite.addTest(TestParams.suite());
suite.addTest(TestExceptions.suite());
suite.addTest(TestAllConnParams.suite());
suite.addTest(TestAllRouting.suite());
suite.addTest(TestAllSSL.suite());
suite.addTest(TestAllUtil.suite());

View File

@ -0,0 +1,61 @@
/*
* $HeadURL$
* $Revision$
* $Date$
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.conn.params;
import org.apache.http.conn.routing.TestAllRouting;
import org.apache.http.conn.ssl.TestAllSSL;
import org.apache.http.conn.util.TestAllUtil;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class TestAllConnParams extends TestCase {
public TestAllConnParams(String testName) {
super(testName);
}
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(TestParams.suite());
suite.addTest(TestRouteParams.suite());
return suite;
}
public static void main(String args[]) {
String[] testCaseName = { TestAllConnParams.class.getName() };
junit.textui.TestRunner.main(testCaseName);
}
}

View File

@ -29,7 +29,7 @@
*
*/
package org.apache.http.conn;
package org.apache.http.conn.params;
import junit.framework.Test;
import junit.framework.TestCase;

View File

@ -0,0 +1,111 @@
/*
* $HeadURL$
* $Revision$
* $Date$
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.conn.params;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.http.HttpHost;
import org.apache.http.params.HttpParams;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.conn.params.HttpConnectionManagerParams;
import org.apache.http.conn.routing.HttpRoute;
/**
* Unit tests for parameters.
* Trivial, but it looks better in the Clover reports.
*/
public class TestRouteParams extends TestCase {
public final static
HttpHost TARGET1 = new HttpHost("target1.test.invalid");
public final static
HttpRoute ROUTE1 = new HttpRoute(TARGET1);
public TestRouteParams(String testName) {
super(testName);
}
public static void main(String args[]) {
String[] testCaseName = { TestRouteParams.class.getName() };
junit.textui.TestRunner.main(testCaseName);
}
public static Test suite() {
return new TestSuite(TestRouteParams.class);
}
public void testBadArgs() {
try {
HttpRouteParams.getDefaultProxy(null);
} catch (IllegalArgumentException iax) {
// expected
}
try {
HttpRouteParams.getForcedRoute(null);
} catch (IllegalArgumentException iax) {
// expected
}
try {
HttpRouteParams.getLocalAddress(null);
} catch (IllegalArgumentException iax) {
// expected
}
try {
HttpRouteParams.setDefaultProxy(null, null);
} catch (IllegalArgumentException iax) {
// expected
}
try {
HttpRouteParams.setForcedRoute(null, null);
} catch (IllegalArgumentException iax) {
// expected
}
try {
HttpRouteParams.setLocalAddress(null, null);
} catch (IllegalArgumentException iax) {
// expected
}
}
}