You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Glenn Murray <gm...@mines.edu> on 2005/07/12 00:13:17 UTC
HttpClient won't run in Swing JUnit
Hi,
I've got a strange JUnit/HttpClient problem. If I run the
ff. class with
java -cp .:commons-httpclient-2.0.2.jar:commons-logging.jar:junit_3.8.1.jar junit.textui.TestRunner Test2
it passes, but if I run
java -cp .:commons-httpclient-2.0.2.jar:commons-logging.jar:junit_3.8.1.jar junit.swingui.TestRunner Test2
it fails. Is it not possible to run HttpClient from JUnit's
Swing TestRunner? Part of the mystery is that
commons-logging.jar need not be in the classpath when I
compile. Also, the ExceptionInInitializerError won't get
printed.
Thanks,
Glenn
import junit.framework.TestCase;
import org.apache.commons.httpclient.HttpClient;
/**
* A short class for testing.
*/
public class Test2 extends TestCase {
/**
* For JUnit.
*/
public Test2(String name) {
super(name);
}
public void testIt() {
try{
System.out.println("Yo, "+System.getProperty("user.name")+"!");
HttpClient client = new HttpClient();
}catch(Exception e) {
e.printStackTrace();
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: HttpClient won't run in Swing JUnit
Posted by Glenn Murray <gm...@Mines.EDU>.
On Wed, 13 Jul 2005, Michael Becke wrote:
> Hi Glenn,
>
> Don't know, that's a weird one. My first reaction is that it's just a
> coincidence and has nothing to do with the presence (or lack) of
> HttpClient.
>
> Mike
Hi,
This is an easy bug to reproduce:
javac -classpath .:commons-httpclient-2.0.2.jar:junit_3.8.1.jar HttpClientBug.java
java -cp .:commons-httpclient-2.0.2.jar:commons-logging.jar:junit_3.8.1.jar junit.textui.TestRunner HttpClientBug
java -cp .:commons-httpclient-2.0.2.jar:commons-logging.jar:junit_3.8.1.jar junit.swingui.TestRunner HttpClientBug
I've verified it on Linux and WinXP with Java 1.5.
Part of the mystery is that commons-logging.jar need not
be in the classpath when I compile. Also, the
ExceptionInInitializerError won't get printed.
Thanks,
Glenn
import junit.framework.TestCase;
import org.apache.commons.httpclient.HttpClient;
public class HttpClientBug extends TestCase {
public void testIt() {
try{
System.out.println("Yo, "+System.getProperty("user.name")+"!");
HttpClient client = new HttpClient();
}catch(Exception e) {
e.printStackTrace();
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: HttpClient won't run in Swing JUnit
Posted by Michael Becke <mb...@gmail.com>.
Hi Glenn,
Don't know, that's a weird one. My first reaction is that it's just a
coincidence and has nothing to do with the presence (or lack) of
HttpClient.
Mike
On 7/11/05, Glenn Murray <gm...@mines.edu> wrote:
> Hi,
>
> I've got a strange JUnit/HttpClient problem. If I run the
> ff. class with
>
> java -cp .:commons-httpclient-2.0.2.jar:commons-logging.jar:junit_3.8.1.jar junit.textui.TestRunner Test2
>
> it passes, but if I run
>
> java -cp .:commons-httpclient-2.0.2.jar:commons-logging.jar:junit_3.8.1.jar junit.swingui.TestRunner Test2
>
> it fails. Is it not possible to run HttpClient from JUnit's
> Swing TestRunner? Part of the mystery is that
> commons-logging.jar need not be in the classpath when I
> compile. Also, the ExceptionInInitializerError won't get
> printed.
>
> Thanks,
> Glenn
>
>
> import junit.framework.TestCase;
> import org.apache.commons.httpclient.HttpClient;
> /**
> * A short class for testing.
> */
> public class Test2 extends TestCase {
> /**
> * For JUnit.
> */
> public Test2(String name) {
> super(name);
> }
>
> public void testIt() {
> try{
> System.out.println("Yo, "+System.getProperty("user.name")+"!");
> HttpClient client = new HttpClient();
> }catch(Exception e) {
> e.printStackTrace();
> }
> }
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org