1 21 22 package org.jacorb.test.notification.engine; 23 24 import junit.framework.TestCase; 25 26 import org.easymock.MockControl; 27 import org.jacorb.notification.engine.AbstractRetryStrategy; 28 import org.jacorb.notification.engine.PushOperation; 29 import org.jacorb.notification.interfaces.IProxyPushSupplier; 30 31 35 public abstract class AbstractRetryStrategyTest extends TestCase 36 { 37 protected IProxyPushSupplier mockConsumer_; 38 protected MockControl controlConsumer_; 39 protected PushOperation mockPushOperation_; 40 protected MockControl controlPushOperation_; 41 42 protected AbstractRetryStrategy objectUnderTest_; 43 44 48 public AbstractRetryStrategyTest(String name) 49 { 50 super(name); 51 } 52 53 protected final void setUp() throws Exception 54 { 55 super.setUp(); 56 57 controlConsumer_ = MockControl.createNiceControl(IProxyPushSupplier.class); 58 mockConsumer_ = (IProxyPushSupplier) controlConsumer_.getMock(); 59 60 controlPushOperation_ = MockControl.createNiceControl(PushOperation.class); 61 mockPushOperation_ = (PushOperation) controlPushOperation_.getMock(); 62 63 setUpTest(); 64 65 objectUnderTest_ = newRetryStrategy(); 66 } 67 68 protected abstract void setUpTest(); 69 70 protected abstract AbstractRetryStrategy newRetryStrategy(); 71 72 public void testNoRetryAllowedDisposesPushOperation() throws Exception 73 { 74 mockConsumer_.isRetryAllowed(); 75 controlConsumer_.setDefaultReturnValue(false); 76 77 controlConsumer_.replay(); 78 79 mockPushOperation_.dispose(); 80 controlPushOperation_.replay(); 81 82 objectUnderTest_.retry(); 83 84 controlConsumer_.verify(); 85 controlPushOperation_.verify(); 86 } 87 } 88 | Popular Tags |