Ejemplo n.º 1
0
 @Test
 public void testSuspendedDoesNothing() throws Exception {
   mockMessageSupplier_.getConnected();
   controlMessageSupplier_.setReturnValue(true);
   mockMessageSupplier_.isSuspended();
   controlMessageSupplier_.setReturnValue(true);
   controlMessageSupplier_.replay();
   objectUnderTest_.runPull();
   controlMessageSupplier_.verify();
 }
Ejemplo n.º 2
0
 @Test
 public void testNotConnectedDoesNothing() throws Exception {
   mockMessageSupplier_.getConnected();
   controlMessageSupplier_.setReturnValue(false);
   controlMessageSupplier_.replay();
   try {
     objectUnderTest_.runPull();
   } catch (Disconnected e) {
     // expected
   }
   controlMessageSupplier_.verify();
 }
Ejemplo n.º 3
0
  @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();
  }
Ejemplo n.º 4
0
  @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();
  }