Re: Re: Can I call my Restlet classes without a Web container?
For example: Thanks, this is just what I was looking for. The sample code is much appreciated. I'll give it a whirl. I am certainly in agreement with the wisdom of separating business logic from the vehicle used to convey it, where feasible. I'm dealing with existing code here -- but also there are things that are interesting to test other than the underlying business logic, such as proper handling of the parameters to a restlet. Unit testing the Restlet itself thing seems like a value, although I suppose the ideal isolation would consist of unit testing the Restlet, with the Restlet invoking a mock for the business logic.
Can I call my Restlet classes without a Web container?
I'm interested in adding a unit test for certain aspects of the behavior of my REST service, one that can execute outside the confines of a Web server. It would be sufficient if there were merely a way for me to call the Restlet classes directly, then examine the response. What's not obvious to me is how one would go about this. I'd need to create Request and Response objects, obviously, but what's the best way to do that, and what would I need to put in there? Is there a Factory somewhere I should be using for this? Or is this the wrong approach; is there some other way to accomplish this (short of decoupling the code underlying the Restlet and testing that by itself)? Thanks, -- Bryan