jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J. B. Rainsberger" <jbra...@rogers.com>
Subject Re: Assesrtion Failed Error while JSP Testing
Date Mon, 09 Feb 2004 20:34:51 GMT
Dinesh N wrote:

> Hi Friends,
>     I am new to this technology. I am testing a jsp page which do some operation on java
compiled class.
> 
> Now i have created some test case like:
> 
> public void teststringArray3()
> 	{
> 		 System.out.println("Value is "+session.getServletContext().getAttribute("stringArray3Count"));


> 		 assertSame("This should be same","1",session.getServletContext().getAttribute("stringArray3Count"));

Don't use assertSame() here, anyway: there is no way that the servlet 
context will return the same String object as the literal string "1". 
Use assertEquals() instead.

As for why the servlet context attribute has a null value, we need to 
see more code, such as the code that puts "stringArray3Count" in the 
servlet context in the first place.
-- 
J. B. Rainsberger,
Diaspar Software Services
http://www.diasparsoftware.com :: +1 416 791-8603
Let's write software that people understand

Mime
View raw message