Hi Ankur,

Welcome to our indian friends !

You must bear in mind that the Servlet Redirector view your method to test
as a normal method (it does not know that it is actually a servlet which has
a specific life cycle and for which the init() method is always called). So
the simplest way to do it is simply to explicitely call your init() method
like this :

public void testXXX()
{
  MyServlet servlet = new MyServlet();
  servlet.init(config);

  // do your asserts here
}

Thanks
Vincent

----- Original Message -----
From: "Dang, Ankur (CORP, GEITC)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 22, 2001 2:12 PM
Subject: Need help on Cactus.


> Hi,
>
> I' m working at GE India Technology Center, Bangalore, India.I need some
> help regarding Cactus 1.0.
> While testing servlets, I set some attributes in the init( ) method of the
> servlet.To check if the servlet has set these attributes,I check for their
> values(in order to compare using assertEquals)in the Test case for the
init(
> ) method. However, I'm not getting the required values in the test case.It
> shows that the values of the attributes is null.
>
> Is there any way that I can check for the values that I'm
> setting/initializing in the init( ) method by using a test case?
>
> Regards,
> Ankur.
>
>
>
> > g  John F Welch Technology Centre
> > __________________________________________________
> > Ankur Dang
> >
> > GE India Technology Centre Pvt. Ltd.
> > E-Engineering Lab,
> > Export Promotional Industrial Park,Phase:2,
> > Hoodi Village, Whitefield Road,
> > Bangalore - 560 066, India
> > Phone (off): +91 (80) 8412050  Extn: 2684
> > Phone (res): +91 (80) 5529413
> > E-mail:   [EMAIL PROTECTED]
> >
>

Reply via email to