From: Vincent T. <vt...@sy...> - 2002-04-23 02:33:13
|
Laurent, Jeff has been busy recently reorganizing the CVS tree. You should get the latest source from CVS. Mocks for servlet 2.3 are located under j2ee/1.3/com/mockobjects/servlet. getParametersMap() is not yet implemented but attached is a patch that does it. Best is to add the expected behavior to the Mock rather than extending it. We implement little by little as our needs grow. Guys, can anyone of you review the patch and apply it if it makes sense (it's pretty late for me now ;-)) -- Vincent On Mon, 2002-04-22 at 19:32, lau...@ma... wrote: > On 22 Apr, To: MockObjects Users List wrote: > > and the test code (I modified it a bit since my earlier post): > > > > public void setUp() { > > servletRequest = new MockHttpServletRequest(); > > servletRequest.setupAddParameter("param1", "value1"); > > servletRequest.setupAddParameter("param2", "value2"); > > servletRequest.setupAddParameter("param3", "value3"); > > } > > > > public void testNoMissingParameters() { > > String[] requiredParams = { "param1", "param2", "param3" }; > > parser = new ParameterParser(requiredParams, servletRequest); > > assertTrue("Required parameter missing ", parser.getMissingParameters() == null); > > } > > > > Ok, so I changed the test code to add this: > > class TestMockHttpServletRequest extends MockHttpServletRequest { > > HashMap paramMap = new HashMap(); > > TestMockHttpServletRequest() { > super(); > } > > public void setupAddParameter(String s, String s1) { > super.setupAddParameter(s, s1); > paramMap.put(s, s1); > } > > public Map getParameterMap() { > return paramMap; > } > } > > and I use this class as my mock object. I now get the expected behaviour. > However, I'm not sure that's the correct way to do things. > > L > > -- > Laurent Duperval <mailto:lau...@ma...> > > Murphy's Laws for Frequent Flyers > 2. If you are running late for a flight, it will depart from the farthest > gate within the terminal. > > > > _______________________________________________ > Mockobjects-java-users mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-users |