1 15 package org.apache.tapestry.portlet; 16 17 import javax.portlet.PortletResponse; 18 19 import org.apache.tapestry.util.ContentType; 20 import org.easymock.MockControl; 21 22 28 public class TestPortletWebResponse extends BasePortletWebTestCase 29 { 30 private PortletResponse newResponse() 31 { 32 return (PortletResponse) newMock(PortletResponse.class); 33 } 34 35 public void testGetOutputStreamUnsupported() throws Exception 36 { 37 PortletResponse response = newResponse(); 38 39 replayControls(); 40 41 PortletWebResponse pwr = new PortletWebResponse(response); 42 43 try 44 { 45 pwr.getOutputStream(new ContentType("foo/bar")); 46 unreachable(); 47 } 48 catch (UnsupportedOperationException ex) 49 { 50 } 52 53 verifyControls(); 54 } 55 56 public void testGetNamespace() throws Exception 57 { 58 PortletResponse response = newResponse(); 59 60 replayControls(); 61 62 PortletWebResponse pwr = new PortletWebResponse(response); 63 64 assertEquals("", pwr.getNamespace()); 65 66 verifyControls(); 67 } 68 69 public void testResetUnsupported() 70 { 71 PortletResponse response = newResponse(); 72 73 replayControls(); 74 75 PortletWebResponse pwr = new PortletWebResponse(response); 76 77 try 78 { 79 pwr.reset(); 80 unreachable(); 81 } 82 catch (UnsupportedOperationException ex) 83 { 84 } 86 87 verifyControls(); 88 } 89 90 public void testEncodeURL() 91 { 92 MockControl control = newControl(PortletResponse.class); 93 PortletResponse response = (PortletResponse) control.getMock(); 94 95 response.encodeURL("/foo"); 96 control.setReturnValue("/foo;encoded"); 97 98 replayControls(); 99 100 PortletWebResponse pwr = new PortletWebResponse(response); 101 102 assertEquals("/foo;encoded", pwr.encodeURL("/foo")); 103 104 verifyControls(); 105 } 106 } | Popular Tags |