rwaldhoff 01/08/03 09:57:29
Modified: httpclient/src/test/org/apache/commons/httpclient
TestAll.java TestAllExternal.java TestAllLocal.java
Added: httpclient/src/test/org/apache/commons/httpclient
TestHeader.java TestNVP.java
Log:
adding tests for NameValuePair and Header
Revision Changes Path
1.6 +6 -4
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAll.java
Index: TestAll.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAll.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestAll.java 2001/08/02 20:32:05 1.5
+++ TestAll.java 2001/08/03 16:57:29 1.6
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAll.java,v
1.5 2001/08/02 20:32:05 rwaldhoff Exp $
- * $Revision: 1.5 $
- * $Date: 2001/08/02 20:32:05 $
+ * $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAll.java,v
1.6 2001/08/03 16:57:29 rwaldhoff Exp $
+ * $Revision: 1.6 $
+ * $Date: 2001/08/03 16:57:29 $
* ====================================================================
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
@@ -17,7 +17,7 @@
/**
* @author Remy Maucherat
* @author Rodney Waldhoff
- * @version $Id: TestAll.java,v 1.5 2001/08/02 20:32:05 rwaldhoff Exp $
+ * @version $Id: TestAll.java,v 1.6 2001/08/03 16:57:29 rwaldhoff Exp $
*/
public class TestAll extends TestCase {
@@ -31,6 +31,8 @@
suite.addTest(TestCookie.suite());
suite.addTest(TestHttps.suite());
suite.addTest(TestMethods.suite());
+ suite.addTest(TestNVP.suite());
+ suite.addTest(TestHeader.suite());
return suite;
}
1.3 +6 -4
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAllExternal.java
Index: TestAllExternal.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAllExternal.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestAllExternal.java 2001/08/02 20:32:05 1.2
+++ TestAllExternal.java 2001/08/03 16:57:29 1.3
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAllExternal.java,v
1.2 2001/08/02 20:32:05 rwaldhoff Exp $
- * $Revision: 1.2 $
- * $Date: 2001/08/02 20:32:05 $
+ * $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAllExternal.java,v
1.3 2001/08/03 16:57:29 rwaldhoff Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/08/03 16:57:29 $
* ====================================================================
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
@@ -16,7 +16,7 @@
/**
* @author Rodney Waldhoff
- * @version $Id: TestAllExternal.java,v 1.2 2001/08/02 20:32:05 rwaldhoff Exp $
+ * @version $Id: TestAllExternal.java,v 1.3 2001/08/03 16:57:29 rwaldhoff Exp $
*/
public class TestAllExternal extends TestCase {
@@ -30,6 +30,8 @@
suite.addTest(TestCookie.suite());
suite.addTest(TestHttps.suite());
suite.addTest(TestMethodsExternalHost.suite());
+ suite.addTest(TestNVP.suite());
+ suite.addTest(TestHeader.suite());
return suite;
}
1.3 +6 -4
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAllLocal.java
Index: TestAllLocal.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAllLocal.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestAllLocal.java 2001/08/02 20:32:05 1.2
+++ TestAllLocal.java 2001/08/03 16:57:29 1.3
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAllLocal.java,v
1.2 2001/08/02 20:32:05 rwaldhoff Exp $
- * $Revision: 1.2 $
- * $Date: 2001/08/02 20:32:05 $
+ * $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAllLocal.java,v
1.3 2001/08/03 16:57:29 rwaldhoff Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/08/03 16:57:29 $
* ====================================================================
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
@@ -16,7 +16,7 @@
/**
* @author Rodney Waldhoff
- * @version $Id: TestAllLocal.java,v 1.2 2001/08/02 20:32:05 rwaldhoff Exp $
+ * @version $Id: TestAllLocal.java,v 1.3 2001/08/03 16:57:29 rwaldhoff Exp $
*/
public class TestAllLocal extends TestCase {
@@ -29,6 +29,8 @@
suite.addTest(TestBase64.suite());
suite.addTest(TestCookie.suite());
suite.addTest(TestMethodsLocalHost.suite());
+ suite.addTest(TestNVP.suite());
+ suite.addTest(TestHeader.suite());
return suite;
}
1.1
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHeader.java
Index: TestHeader.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHeader.java,v
1.1 2001/08/03 16:57:29 rwaldhoff Exp $
* $Revision: 1.1 $
* $Date: 2001/08/03 16:57:29 $
* ====================================================================
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.commons.httpclient;
import junit.framework.*;
/**
* Simple tests for {@link NameValuePair}.
*
* @author Rodney Waldhoff
* @version $Id: TestHeader.java,v 1.1 2001/08/03 16:57:29 rwaldhoff Exp $
*/
public class TestHeader extends TestNVP {
// ------------------------------------------------------------ Constructor
public TestHeader(String testName) {
super(testName);
}
// ------------------------------------------------------------------- Main
public static void main(String args[]) {
String[] testCaseName = { TestHeader.class.getName() };
junit.textui.TestRunner.main(testCaseName);
}
// ------------------------------------------------------- TestCase Methods
public static Test suite() {
return new TestSuite(TestHeader.class);
}
// ------------------------------------------------------ Protected Methods
protected NameValuePair makePair() {
return new Header();
}
protected NameValuePair makePair(String name, String value) {
return new Header(name,value);
}
// ----------------------------------------------------------- Test Methods
public void testToStringNull() {
NameValuePair header = makePair();
assertEquals("null: null\r\n",header.toString());
}
public void testToString() {
NameValuePair header = makePair("a","b");
assertEquals("a: b\r\n",header.toString());
}
public void testNotEqualToNVP() {
NameValuePair header = makePair("a","b");
NameValuePair pair = new NameValuePair("a","b");
assert(!header.equals(pair));
assert(!pair.equals(header));
}
}
1.1
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestNVP.java
Index: TestNVP.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestNVP.java,v
1.1 2001/08/03 16:57:29 rwaldhoff Exp $
* $Revision: 1.1 $
* $Date: 2001/08/03 16:57:29 $
* ====================================================================
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.commons.httpclient;
import junit.framework.*;
/**
* Simple tests for {@link NameValuePair}.
*
* @author Rodney Waldhoff
* @version $Id: TestNVP.java,v 1.1 2001/08/03 16:57:29 rwaldhoff Exp $
*/
public class TestNVP extends TestCase {
// ------------------------------------------------------------ Constructor
public TestNVP(String testName) {
super(testName);
}
// ------------------------------------------------------------------- Main
public static void main(String args[]) {
String[] testCaseName = { TestNVP.class.getName() };
junit.textui.TestRunner.main(testCaseName);
}
// ------------------------------------------------------- TestCase Methods
public static Test suite() {
return new TestSuite(TestNVP.class);
}
// ------------------------------------------------------ Protected Methods
protected NameValuePair makePair() {
return new NameValuePair();
}
protected NameValuePair makePair(String name, String value) {
return new NameValuePair(name,value);
}
// ----------------------------------------------------------- Test Methods
public void testGet() {
NameValuePair pair = makePair("name 1","value 1");
assertEquals("name 1",pair.getName());
assertEquals("value 1",pair.getValue());
}
public void testSet() {
NameValuePair pair = makePair();
assert(null == pair.getName());
assert(null == pair.getValue());
pair.setName("name");
assertEquals("name",pair.getName());
pair.setValue("value");
assertEquals("value",pair.getValue());
}
public void testEqualsAndHashCode() {
NameValuePair pair1 = makePair();
NameValuePair pair2 = makePair();
assertEquals(pair1,pair1);
assertEquals(pair1.hashCode(),pair1.hashCode());
assertEquals(pair2,pair2);
assertEquals(pair2.hashCode(),pair2.hashCode());
assertEquals(pair1,pair2);
assertEquals(pair1.hashCode(),pair2.hashCode());
assertEquals(pair2,pair1);
pair1.setName("name");
pair1.setValue("value");
assertEquals(pair1,pair1);
assertEquals(pair1.hashCode(),pair1.hashCode());
assert(!pair1.equals(pair2));
assert(!pair2.equals(pair1));
pair2.setName("name");
assertEquals(pair1,pair1);
assertEquals(pair1.hashCode(),pair1.hashCode());
assertEquals(pair2,pair2);
assertEquals(pair2.hashCode(),pair2.hashCode());
assert(!pair1.equals(pair2));
assert(!pair2.equals(pair1));
pair2.setValue("value");
assertEquals(pair1,pair1);
assertEquals(pair1.hashCode(),pair1.hashCode());
assertEquals(pair2,pair2);
assertEquals(pair2.hashCode(),pair2.hashCode());
assertEquals(pair1,pair2);
assertEquals(pair1.hashCode(),pair2.hashCode());
assertEquals(pair2,pair1);
}
}