Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Testing and the fly likes How to do unit testing for Cookies in JMock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "How to do unit testing for Cookies in JMock" Watch "How to do unit testing for Cookies in JMock" New topic
Author

How to do unit testing for Cookies in JMock

Nitesh Patel
Ranch Hand

Joined: Mar 16, 2008
Posts: 33
Hi All,
I come to a scenario where I need to update my test cases to test Cookies logic. I am unable to find out how can I do this in JMock ? Below is my code,


I am already doing unit test for "header" same way I need to do for Cookies. Can someone please guide me ?
Regards,
Nitesh
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4442
    
    5

The biggest problem you have with code like that is probably figuring out where the actual class under test went to because, well, I don't see one. All I see are context, request, and response and they are all impostors. If you're testing for headers the same way, then that's double trouble for you. What exactly is the class with the real production code that you want to test?


Junilu - [How to Ask Questions] [How to Answer Questions]
 
 
subject: How to do unit testing for Cookies in JMock
 
Similar Threads
Beginning JMock. does this test anything?
Help needed for setting JMock
Doubt with JMock + JUnit [finding a better way to do it]
How to Spy a Method
Java.lang.ClassCastException