@Test public void testSuspendedDoesNothing() throws Exception { mockMessageSupplier_.getConnected(); controlMessageSupplier_.setReturnValue(true); mockMessageSupplier_.isSuspended(); controlMessageSupplier_.setReturnValue(true); controlMessageSupplier_.replay(); objectUnderTest_.runPull(); controlMessageSupplier_.verify(); }
@Test public void testNotConnectedDoesNothing() throws Exception { mockMessageSupplier_.getConnected(); controlMessageSupplier_.setReturnValue(false); controlMessageSupplier_.replay(); try { objectUnderTest_.runPull(); } catch (Disconnected e) { // expected } controlMessageSupplier_.verify(); }
@Test public void testInterruptedThreadDoesNothing() throws Exception { mockMessageSupplier_.getConnected(); controlMessageSupplier_.setReturnValue(true); mockMessageSupplier_.isSuspended(); controlMessageSupplier_.setReturnValue(false); controlMessageSupplier_.replay(); Thread.currentThread().interrupt(); objectUnderTest_.runPull(); controlMessageSupplier_.verify(); }
@Test public void testNonSuccessfulPullIsNotQueued() throws Exception { MessageSupplierDelegate.PullResult _result = new MessageSupplierDelegate.PullResult(new Object(), false); mockMessageSupplier_.getConnected(); controlMessageSupplier_.setReturnValue(true); mockMessageSupplier_.isSuspended(); controlMessageSupplier_.setReturnValue(false); mockMessageSupplier_.pullMessages(); controlMessageSupplier_.setReturnValue(_result); controlMessageSupplier_.replay(); objectUnderTest_.runPull(); controlMessageSupplier_.verify(); }