当前位置: 首页>>代码示例>>Java>>正文


Java Mockito.verifyNoMoreInteractions方法代码示例

本文整理汇总了Java中org.mockito.Mockito.verifyNoMoreInteractions方法的典型用法代码示例。如果您正苦于以下问题:Java Mockito.verifyNoMoreInteractions方法的具体用法?Java Mockito.verifyNoMoreInteractions怎么用?Java Mockito.verifyNoMoreInteractions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mockito.Mockito的用法示例。


在下文中一共展示了Mockito.verifyNoMoreInteractions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testOnDrag

import org.mockito.Mockito; //导入方法依赖的package包/类
@Test
public void testOnDrag() {
    Mockito.verify(mMockController).getClipDataHelper();

    assertThat(mOnDragToTrashListener.onDrag(null, mBlockDragStartFromWorkspace)).isTrue();
    Mockito.verifyNoMoreInteractions(mMockController);

    mOnDragToTrashListener.onDrag(null, mBlockDragEntered);
    Mockito.verifyNoMoreInteractions(mMockController);

    mOnDragToTrashListener.onDrag(null, mBlockDragLocation);
    Mockito.verifyNoMoreInteractions(mMockController);

    mOnDragToTrashListener.onDrag(null, mBlockDragExited);
    Mockito.verifyNoMoreInteractions(mMockController);

    assertThat(mOnDragToTrashListener.onDrag(null, mBlockDrop)).isTrue();
    Mockito.verify(mMockController)
            .trashRootBlock(Mockito.any(Block.class));

    mOnDragToTrashListener.onDrag(null, mBlockDragEnded);
    Mockito.verifyNoMoreInteractions(mMockController);
}
 
开发者ID:Axe-Ishmael,项目名称:Blockly,代码行数:24,代码来源:OnDragToTrashListenerTest.java

示例2: testOnSuccessThrowsError

import org.mockito.Mockito; //导入方法依赖的package包/类
@GwtIncompatible // Mockito
public void testOnSuccessThrowsError() throws Exception {
  class TestError extends Error {}
  TestError error = new TestError();
  String result = "result";
  SettableFuture<String> future = SettableFuture.create();
  @SuppressWarnings("unchecked") // Safe for a mock
  FutureCallback<String> callback = Mockito.mock(FutureCallback.class);
  addCallback(future, callback, directExecutor());
  Mockito.doThrow(error).when(callback).onSuccess(result);
  try {
    future.set(result);
    fail("Should have thrown");
  } catch (TestError e) {
    assertSame(error, e);
  }
  assertEquals(result, future.get());
  Mockito.verify(callback).onSuccess(result);
  Mockito.verifyNoMoreInteractions(callback);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:21,代码来源:FutureCallbackTest.java

示例3: testHandleReceiveRemoveEndpoint

import org.mockito.Mockito; //导入方法依赖的package包/类
@Test
public void testHandleReceiveRemoveEndpoint() throws Exception {
    final Map<Address, Optional<RemoteRpcEndpoint>> endpoints = ImmutableMap.of(
            endpointAddress, Optional.empty());
    testActorRef.tell(new UpdateRemoteEndpoints(endpoints), ActorRef.noSender());
    Mockito.verifyNoMoreInteractions(service, oldReg, newReg);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:RpcRegistrarTest.java

示例4: setTypeFaceForDismissButtonNullTypeFaceTest

import org.mockito.Mockito; //导入方法依赖的package包/类
@Test
public void setTypeFaceForDismissButtonNullTypeFaceTest() {
    Mockito.when(mTypeFaceProvider.getTypeFaceFromAssets(Matchers.anyString())).thenReturn(null);

    mPopUpCoachMarkPresenter.setTypeFaceForDismissButton(Matchers.anyString());

    Mockito.verify(mTypeFaceProvider, Mockito.times(1)).getTypeFaceFromAssets(Matchers.anyString());
    Mockito.verify(mPopUpCoachMarkPresentation, Mockito.times(0))
            .setTypeFaceForDismissButton((Typeface) Matchers.anyObject());

    Mockito.verifyNoMoreInteractions(mPopUpCoachMarkPresentation);
}
 
开发者ID:myntra,项目名称:CoachMarks,代码行数:13,代码来源:PopUpCoachMarkPresenterTest.java

示例5: batchInvokedWithTwoElements

import org.mockito.Mockito; //导入方法依赖的package包/类
@Test public void batchInvokedWithTwoElements() {
  Funnel.Batch<Integer, String> toSpell = funnel.through(batch::send);
  toSpell.accept(1);
  toSpell.accept(2);
  when(batch.send(asList(1, 2))).thenReturn(asList("one", "two"));
  assertThat(funnel.run()).containsExactly("one", "two").inOrder();
  Mockito.verify(batch).send(asList(1, 2));
  Mockito.verifyNoMoreInteractions(batch);
}
 
开发者ID:google,项目名称:mug,代码行数:10,代码来源:FunnelTest.java

示例6: testClientFromFactory

import org.mockito.Mockito; //导入方法依赖的package包/类
@Test
public void testClientFromFactory() {
    AmazonSQSClient sqs = Mockito.mock(AmazonSQSClient.class);
    SqsMessage m = new SqsMessage(RECEIPT_HANDLE, new byte[] {}, 1000, Optional.empty(),
            new SqsMessage.Service(Optional.empty(), () -> sqs, Optional.empty(), sqs, QUEUE,
                    Optional.empty()));
    Mockito.when(sqs.deleteMessage(QUEUE, RECEIPT_HANDLE))
            .thenReturn(new DeleteMessageResult());
    m.deleteMessage(Client.FROM_FACTORY);
    InOrder inorder = Mockito.inOrder(sqs);
    inorder.verify(sqs, Mockito.times(1)).deleteMessage(QUEUE, RECEIPT_HANDLE);
    inorder.verify(sqs, Mockito.times(1)).shutdown();
    Mockito.verifyNoMoreInteractions(sqs);
}
 
开发者ID:davidmoten,项目名称:rxjava2-aws,代码行数:15,代码来源:SqsMessageTest.java

示例7: testBeforeParse

import org.mockito.Mockito; //导入方法依赖的package包/类
@Test
public void testBeforeParse() {
    Document parse = XMLParser.parse(Templates.TEMPLATE_WITHOUT_CONTENT_WITH_FULLSCREEN);
    instance = spy(factory.getImgTemplateParser(parse.getDocumentElement(), moduleSocket));
    instance.beforeParse(mock(Node.class), null);
    verify(instance).beforeParse(Matchers.any(Node.class), Matchers.any(Widget.class));
    Mockito.verifyNoMoreInteractions(instance);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:9,代码来源:ImgTemplateParserJUnitTest.java

示例8: batchInvokedWithAftereffect

import org.mockito.Mockito; //导入方法依赖的package包/类
@Test public void batchInvokedWithAftereffect() {
  Funnel.Batch<Integer, String> toSpell = funnel.through(batch::send);
  AtomicReference<String> spelled = new AtomicReference<>();
  toSpell.accept(1, spelled::set);
  toSpell.accept(2);
  when(batch.send(asList(1, 2))).thenReturn(asList("one", "two"));
  assertThat(funnel.run()).containsExactly("one", "two").inOrder();
  assertThat(spelled.get()).isEqualTo("one");
  Mockito.verify(batch).send(asList(1, 2));
  Mockito.verifyNoMoreInteractions(batch);
}
 
开发者ID:google,项目名称:mug,代码行数:12,代码来源:FunnelTest.java

示例9: shouldNotSendDeleteRequestIfResultIsEmpty

import org.mockito.Mockito; //导入方法依赖的package包/类
@Test
public void shouldNotSendDeleteRequestIfResultIsEmpty() {
    final List<Message> messages = Collections.emptyList();
    Mockito.when(this.channel.getMessages()).thenReturn(messages);
    assertThat(this.monitor.add(this.listener)).isTrue();
    Mockito.verify(this.channel).getQueueUuid();
    Mockito.verify(this.listener).getQueueUuid();
    Mockito.verify(this.executor).execute(this.monitor);

    this.monitor.run();

    Mockito.verify(this.channel).getMessages();
    Mockito.verifyNoMoreInteractions(this.listener);
    Mockito.verify(this.executor, Mockito.times(2)).execute(this.monitor);
}
 
开发者ID:riboseinc,项目名称:aws-codecommit-trigger-plugin,代码行数:16,代码来源:SQSQueueMonitorImplTest.java

示例10: testHandleReceiveAddEndpoint

import org.mockito.Mockito; //导入方法依赖的package包/类
@Test
public void testHandleReceiveAddEndpoint() throws Exception {
    final Map<Address, Optional<RemoteRpcEndpoint>> endpoints = ImmutableMap.of(
            endpointAddress, Optional.of(firstEndpoint));
    testActorRef.tell(new UpdateRemoteEndpoints(endpoints), ActorRef.noSender());

    Mockito.verify(service).registerRpcImplementation(
            Mockito.any(RemoteRpcImplementation.class), Mockito.eq(firstEndpoint.getRpcs()));
    Mockito.verifyNoMoreInteractions(service, oldReg, newReg);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:11,代码来源:RpcRegistrarTest.java

示例11: shouldNotStopBeforeLastListenerRemoved

import org.mockito.Mockito; //导入方法依赖的package包/类
@Test
public void shouldNotStopBeforeLastListenerRemoved() {
    this.monitor.add(this.listener);
    this.monitor.add(this.listener);
    Mockito.verify(this.executor).execute(this.monitor);

    final boolean result = this.monitor.remove(this.listener);

    assertThat(result).isFalse();
    Mockito.verifyNoMoreInteractions(this.executor);
    assertThat(this.monitor.isShutDown()).isFalse();
}
 
开发者ID:riboseinc,项目名称:aws-codecommit-trigger-plugin,代码行数:13,代码来源:SQSQueueMonitorImplTest.java

示例12: testFakeScheduledExecutorService_taskScheduleAnotherTask

import org.mockito.Mockito; //导入方法依赖的package包/类
@Test public void testFakeScheduledExecutorService_taskScheduleAnotherTask() {
  Runnable runnable = mock(Runnable.class);
  Runnable scheduled = () -> executor.schedule(runnable, 3, TimeUnit.MILLISECONDS);
  executor.schedule(scheduled, 2, TimeUnit.MILLISECONDS);
  elapse(Duration.ofMillis(2));
  elapse(Duration.ofMillis(3));
  verify(runnable).run();
  Mockito.verifyNoMoreInteractions(runnable);
}
 
开发者ID:google,项目名称:mug,代码行数:10,代码来源:RetryerTest.java

示例13: deleteMessageFromFactoryWhenS3FactoryExists

import org.mockito.Mockito; //导入方法依赖的package包/类
@Test
public void deleteMessageFromFactoryWhenS3FactoryExists() {
    AmazonSQSClient sqs = Mockito.mock(AmazonSQSClient.class);
    AmazonS3Client s3 = Mockito.mock(AmazonS3Client.class);
    String s3Id = "123";
    SqsMessage m = new SqsMessage(RECEIPT_HANDLE, new byte[] {}, 1000, Optional.of(s3Id),
            new SqsMessage.Service(Optional.of(() -> s3), () -> sqs, Optional.of(s3), sqs,
                    QUEUE, Optional.of(BUCKET)));
    Mockito.when(sqs.deleteMessage(QUEUE, RECEIPT_HANDLE))
            .thenReturn(new DeleteMessageResult());
    m.deleteMessage(Client.FROM_FACTORY);
    InOrder inorder = Mockito.inOrder(sqs, s3);
    inorder.verify(s3, Mockito.times(1)).deleteObject(BUCKET, s3Id);
    inorder.verify(sqs, Mockito.times(1)).deleteMessage(QUEUE, RECEIPT_HANDLE);
    inorder.verify(s3, Mockito.times(1)).shutdown();
    inorder.verify(sqs, Mockito.times(1)).shutdown();
    Mockito.verifyNoMoreInteractions(sqs, s3);
}
 
开发者ID:davidmoten,项目名称:rxjava2-aws,代码行数:19,代码来源:SqsMessageTest.java

示例14: testOnSuccessThrowsRuntimeException

import org.mockito.Mockito; //导入方法依赖的package包/类
@GwtIncompatible // Mockito
public void testOnSuccessThrowsRuntimeException() throws Exception {
  RuntimeException exception = new RuntimeException();
  String result = "result";
  SettableFuture<String> future = SettableFuture.create();
  @SuppressWarnings("unchecked") // Safe for a mock
  FutureCallback<String> callback = Mockito.mock(FutureCallback.class);
  addCallback(future, callback, directExecutor());
  Mockito.doThrow(exception).when(callback).onSuccess(result);
  future.set(result);
  assertEquals(result, future.get());
  Mockito.verify(callback).onSuccess(result);
  Mockito.verifyNoMoreInteractions(callback);
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:15,代码来源:FutureCallbackTest.java

示例15: shouldStopIfLastListenerRemoved

import org.mockito.Mockito; //导入方法依赖的package包/类
@Test
public void shouldStopIfLastListenerRemoved() {
    this.monitor.add(this.listener);
    this.monitor.add(this.listener);
    this.monitor.remove(this.listener);
    Mockito.verify(this.executor).execute(this.monitor);

    final boolean result = this.monitor.remove(this.listener);

    assertThat(result).isTrue();
    Mockito.verifyNoMoreInteractions(this.executor);
    assertThat(this.monitor.isShutDown()).isTrue();
}
 
开发者ID:riboseinc,项目名称:aws-codecommit-trigger-plugin,代码行数:14,代码来源:SQSQueueMonitorImplTest.java


注:本文中的org.mockito.Mockito.verifyNoMoreInteractions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。