1 package org.jacorb.test.notification.engine; 2 3 22 23 import junit.framework.TestCase; 24 import junit.framework.TestSuite; 25 26 import org.easymock.MockControl; 27 import org.jacorb.notification.engine.MessagePushOperation; 28 import org.jacorb.notification.interfaces.Message; 29 30 34 public class PushOperationTest extends TestCase 35 { 36 static class MockPushOperation extends MessagePushOperation 37 { 38 int pushInvoked = 0; 39 40 public MockPushOperation(Message message) 41 { 42 super(message); 43 } 44 45 public void invokePush() 46 { 47 ++pushInvoked; 48 } 49 } 50 51 public PushOperationTest(String name) 52 { 53 super(name); 54 } 55 56 public void testCreateDispose() 57 { 58 MockControl controlMessage = MockControl.createControl(Message.class); 59 Message mockMessage = (Message) controlMessage.getMock(); 60 61 MockControl controlMessage2 = MockControl.createControl(Message.class); 62 Message mockMessage2 = (Message) controlMessage.getMock(); 63 64 mockMessage.clone(); 65 controlMessage.setReturnValue(mockMessage2); 66 67 mockMessage2.dispose(); 68 69 controlMessage2.replay(); 70 controlMessage.replay(); 71 72 MockPushOperation operation = new MockPushOperation(mockMessage); 73 operation.dispose(); 74 75 controlMessage2.verify(); 76 controlMessage.verify(); 77 } 78 79 public static TestSuite suite() 80 { 81 TestSuite suite = new TestSuite(PushOperationTest.class); 82 83 return suite; 84 } 85 86 public static void main(String [] args) 87 { 88 junit.textui.TestRunner.run(suite()); 89 } 90 } | Popular Tags |