|
From: <joh...@sa...> - 2003-07-01 14:11:26
|
Hi everyone. I just started playing around with the new DynamicMockObjects in version 0.09. I litereally copied and pasted the example on this page: http://www.mockobjects.com/wiki/SimpleServletTest And then wrote an implementation of SimpleCalcServlet. I kept the implementation very simple, and this is what it looks like: private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Integer a = Integer.decode(request.getParameter("a")); Integer b = Integer.decode(request.getParameter("b")); int result = a.intValue() + b.intValue(); response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.print("Result = " + result); } Now the test runs, verify works just fine. But the assertEquals() call in the SimpleServletTest fails with this message: Output should be an addition expected:<Result = 7> but was:<java.io.PrintWriter@fa7e74> Now it's obvious what the problem is. The question is, is it something I am doing wrong or a bug? Many thanks, John ------------------------------------------------- "Modernizing Business Processes Through Proven IT Solutions" http://www.sapiens.com/ |
|
From: Nat P. <nat...@b1...> - 2003-07-01 17:51:35
|
It's a bug in the test. I've changed the version on the Wiki (but not ran
it yet) so try copy/pasting it again.
Cheers,
Nat.
_______________________
Dr. Nathaniel Pryce
B13media Ltd.
http://www.b13media.com
+44 (0)7712 526 661
----- Original Message -----
From: <joh...@sa...>
To: <moc...@li...>
Sent: Tuesday, July 01, 2003 3:00 PM
Subject: [MO-java-users] Problem with SimpleServletTest in wiki
> Hi everyone.
>
> I just started playing around with the new DynamicMockObjects in version
0.09. I
> litereally copied and pasted the example on this page:
>
> http://www.mockobjects.com/wiki/SimpleServletTest
>
> And then wrote an implementation of SimpleCalcServlet. I kept the
implementation
> very simple, and this is what it looks like:
>
> private void process(HttpServletRequest request, HttpServletResponse
response)
> throws ServletException, IOException {
> Integer a = Integer.decode(request.getParameter("a"));
> Integer b = Integer.decode(request.getParameter("b"));
>
> int result = a.intValue() + b.intValue();
> response.setContentType("text/html");
>
> PrintWriter out = response.getWriter();
> out.print("Result = " + result);
> }
>
> Now the test runs, verify works just fine. But the assertEquals() call in
the
> SimpleServletTest fails with this message:
>
> Output should be an addition expected:<Result = 7> but
> was:<java.io.PrintWriter@fa7e74>
>
> Now it's obvious what the problem is. The question is, is it something I
am
> doing wrong or a bug?
>
> Many thanks,
> John
>
>
>
> -------------------------------------------------
> "Modernizing Business Processes Through Proven IT Solutions"
> http://www.sapiens.com/
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
> _______________________________________________
> Mockobjects-java-users mailing list
> Moc...@li...
> https://lists.sourceforge.net/lists/listinfo/mockobjects-java-users
|
|
From: <joh...@sa...> - 2003-07-01 19:44:56
|
Nat, Thanks for the reply. I've added my solution to the example on the wiki. Hope you don't mind :) I just figured it could save someone new to this the trouble. Thanks again, John Quoting Nat Pryce <nat...@b1...>: > It's a bug in the test. I've changed the version on the Wiki (but not ran > it yet) so try copy/pasting it again. > > Cheers, > Nat. > _______________________ > Dr. Nathaniel Pryce > B13media Ltd. > http://www.b13media.com > +44 (0)7712 526 661 > > ----- Original Message ----- > From: <joh...@sa...> > To: <moc...@li...> > Sent: Tuesday, July 01, 2003 3:00 PM > Subject: [MO-java-users] Problem with SimpleServletTest in wiki > > > > Hi everyone. > > > > I just started playing around with the new DynamicMockObjects in version > 0.09. I > > litereally copied and pasted the example on this page: > > > > http://www.mockobjects.com/wiki/SimpleServletTest > > > > And then wrote an implementation of SimpleCalcServlet. I kept the > implementation > > very simple, and this is what it looks like: > > > > private void process(HttpServletRequest request, HttpServletResponse > response) > > throws ServletException, IOException { > > Integer a = Integer.decode(request.getParameter("a")); > > Integer b = Integer.decode(request.getParameter("b")); > > > > int result = a.intValue() + b.intValue(); > > response.setContentType("text/html"); > > > > PrintWriter out = response.getWriter(); > > out.print("Result = " + result); > > } > > > > Now the test runs, verify works just fine. But the assertEquals() call in > the > > SimpleServletTest fails with this message: > > > > Output should be an addition expected:<Result = 7> but > > was:<java.io.PrintWriter@fa7e74> > > > > Now it's obvious what the problem is. The question is, is it something I > am > > doing wrong or a bug? > > > > Many thanks, > > John > > > > > > > > ------------------------------------------------- > > "Modernizing Business Processes Through Proven IT Solutions" > > http://www.sapiens.com/ > > > > > > ------------------------------------------------------- > > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > > Data Reports, E-commerce, Portals, and Forums are available now. > > Download today and enter to win an XBOX or Visual Studio .NET. > > http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 > > _______________________________________________ > > Mockobjects-java-users mailing list > > Moc...@li... > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-users > ------------------------------------------------- "Modernizing Business Processes Through Proven IT Solutions" http://www.sapiens.com/ |
|
From: Lucas F. <luc...@gm...> - 2003-07-01 21:05:26
|
Nat Pryce wrote: > It's a bug in the test. I've changed the version on the Wiki (but not ran > it yet) so try copy/pasting it again. > by chance I tried the same last weekend and made the same correction. I wanted to mention it today... Lucas |