You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "David M. Karr" <dm...@earthlink.net> on 2003/01/30 05:43:51 UTC

Why is TestRequestUtils.testAbsoluteURL() failing?

I'm having trouble understanding why one of the unit tests is failing.  The
failure is in "TestRequestUtils.testAbsoluteURL()".  It builds a URL from
"RequestUtils.absoluteURL()" and compares it with the value it expects.  It
says the computed value is not equal to the expected value.

The weird thing is, after I saw this I edited the method to first store the
expected value into a variable, so I can compare against that instead of the
hardcoded value.  I then added "System.out.println" calls for both the computed
and expected strings.  I also printed the result of a call to
"String.equals()", comparing them.  The strings are identical, and it prints
"true" for the "equals" call, and then proceeds to throw an Error from the
"assertEquals" call.

I'm running this test with jdk 1.4.1_01, TC 4.1.10, and junit 3.8.1.

If it matters, here's the stack trace (note that I added 4 lines for the
variable assignment and print statements):

Testcase: testAbsoluteURL took 0.421 sec
	Caused an ERROR
junit.framework.Assert.assertEquals(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
	at org.apache.struts.util.TestRequestUtils.testAbsoluteURL(TestRequestUtils.java:153)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net   ; SCJP; SCWCD




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org