1 15 package org.apache.tapestry.portlet; 16 17 import javax.portlet.RenderResponse; 18 19 import org.apache.tapestry.util.ContentType; 20 import org.easymock.MockControl; 21 22 28 public class TestRenderWebResponse extends BasePortletWebTestCase 29 { 30 private RenderResponse newResponse() 31 { 32 return (RenderResponse) newMock(RenderResponse.class); 33 } 34 35 public void testReset() 36 { 37 RenderResponse response = newResponse(); 38 39 response.reset(); 40 41 replayControls(); 42 43 RenderWebResponse rwr = new RenderWebResponse(response); 44 45 rwr.reset(); 46 47 verifyControls(); 48 } 49 50 public void testGetOutputStream() throws Exception 51 { 52 MockControl control = newControl(RenderResponse.class); 53 RenderResponse response = (RenderResponse) control.getMock(); 54 replayControls(); 55 56 RenderWebResponse rwr = new RenderWebResponse(response); 57 58 try 59 { 60 rwr.getOutputStream(new ContentType("foo/bar")); 61 unreachable(); 62 } 63 catch (UnsupportedOperationException ex) 64 { 65 } 67 68 verifyControls(); 69 } 70 71 public void testGetNamespace() 72 { 73 MockControl control = newControl(RenderResponse.class); 74 RenderResponse response = (RenderResponse) control.getMock(); 75 76 response.getNamespace(); 77 control.setReturnValue("_NAMESPACE_"); 78 79 replayControls(); 80 81 RenderWebResponse rwr = new RenderWebResponse(response); 82 83 assertEquals("_NAMESPACE_", rwr.getNamespace()); 84 85 verifyControls(); 86 } 87 } | Popular Tags |