1 15 package org.apache.tapestry.html; 16 17 import org.apache.hivemind.test.HiveMindTestCase; 18 import org.apache.tapestry.IMarkupWriter; 19 import org.apache.tapestry.IRender; 20 import org.apache.tapestry.IRequestCycle; 21 import org.apache.tapestry.test.Creator; 22 import org.easymock.MockControl; 23 24 30 public class TestShell extends HiveMindTestCase 31 { 32 private Creator _creator = new Creator(); 33 34 private IMarkupWriter newMarkupWriter() 35 { 36 return (IMarkupWriter) newMock(IMarkupWriter.class); 37 } 38 39 private IRequestCycle newRequestCycle(boolean rewinding) 40 { 41 MockControl control = newControl(IRequestCycle.class); 42 IRequestCycle cycle = (IRequestCycle) control.getMock(); 43 44 cycle.isRewinding(); 45 control.setReturnValue(rewinding); 46 47 return cycle; 48 } 49 50 private IRender newRender() 51 { 52 return (IRender) newMock(IRender.class); 53 } 54 55 59 60 public void testRewinding() 61 { 62 IMarkupWriter writer = newMarkupWriter(); 63 IRequestCycle cycle = newRequestCycle(true); 64 65 IRender body = newRender(); 66 67 body.render(writer, cycle); 68 69 replayControls(); 70 71 Shell shell = (Shell) _creator.newInstance(Shell.class); 72 73 shell.addBody(body); 74 75 shell.render(writer, cycle); 76 77 verifyControls(); 78 } 79 } | Popular Tags |