コード例 #1
0
  public void testReplaceEmpty() throws Exception {
    mockInitialQueue_.hasPendingMessages();
    controlInitialQueue_.setReturnValue(false);
    controlInitialQueue_.replay();
    controlReplacementQueue_.replay();

    objectUnderTest_.replaceDelegate(mockReplacementQueue_);
  }
コード例 #2
0
  public void testReplaceNonEmpty() throws Exception {
    final MockControl controlMessage = MockControl.createControl(Message.class);
    final Message mockMessage = (Message) controlMessage.getMock();
    final Message[] mesgs = new Message[] {mockMessage};

    mockInitialQueue_.hasPendingMessages();
    controlInitialQueue_.setReturnValue(true);

    mockInitialQueue_.getAllMessages();
    controlInitialQueue_.setReturnValue(mesgs);

    controlInitialQueue_.replay();

    mockReplacementQueue_.enqeue(mockMessage);

    controlReplacementQueue_.replay();

    objectUnderTest_.replaceDelegate(mockReplacementQueue_);
  }