Java 类org.mockito.internal.verification.Times 实例源码

项目:oscm    文件:ServiceProvisioningPartnerServiceLocalBeanGrantResalePermissionTest.java   
@Test
public void grantResalePermission_BrokerRevShareAtMP() throws Exception {
    // given
    OfferingType resaleType = OfferingType.BROKER;
    setup(resaleType, false, false);

    // when
    resaleCopy = sppslBean.grantResalePermission(
            productTemplate.getProductId(), supplier.getOrganizationId(),
            grantee.getOrganizationId(), resaleType);

    // then
    verifyResaleCopy();

    InOrder inOrder = inOrder(ds);
    inOrder.verify(ds).persist(resaleCopy);
    ArgumentCaptor<CatalogEntry> argCatEntry = ArgumentCaptor
            .forClass(CatalogEntry.class);
    inOrder.verify(ds, new Times(2)).persist(argCatEntry.capture());
    verifyCreatedCatalogEntry(argCatEntry.getValue(), resaleType);

    verifyImageResource();
}
项目:lepka    文件:LepkaImplTest.java   
@Test public void executeBack() throws Exception {

        when(backStack.count()).thenReturn(0);
        lepka.execute(new Back());
        verify(executor, new Times(1)).closeRouter();

        when(backStack.count()).thenReturn(1);
        lepka.execute(new Back());
        verify(executor, new Times(2)).closeRouter();

        when(backStack.count()).thenReturn(2);
        lepka.execute(new Back());
        verify(executor, new Times(1)).closeScreen();

        when(backStack.count()).thenReturn(10);
        lepka.execute(new Back());
        verify(executor, new Times(2)).closeScreen();
    }
项目:monarch    文件:GMSJoinLeaveJUnitTest.java   
@Test
public void testNetworkPartionMessage() throws Exception {
  try {
    initMocks(true);
    System.setProperty(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY, "true");
    gmsJoinLeave.join();
    installView(1, gmsJoinLeaveMemberId, createMemberList(mockMembers[0], mockMembers[1],
        mockMembers[2], gmsJoinLeaveMemberId, mockMembers[3]));
    for (int i = 1; i < 4; i++) {
      RemoveMemberMessage msg =
          new RemoveMemberMessage(gmsJoinLeaveMemberId, mockMembers[i], "crashed");
      msg.setSender(gmsJoinLeaveMemberId);
      gmsJoinLeave.processMessage(msg);
    }
    Timeout to = new Timeout(3 * ServiceConfig.MEMBER_REQUEST_COLLECTION_INTERVAL, new Times(1));
    verify(messenger, to).send(isA(NetworkPartitionMessage.class));

  } finally {
    System.getProperties().remove(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY);
  }
}
项目:jwala    文件:ResourceServiceImplTest.java   
@Test
public void testCreateGroupedJvmsTemplate() {
    final InputStream metaDataIn = this.getClass().getClassLoader()
            .getResourceAsStream("resource-service-test-files/create-grouped-jvms-template-test-metadata.json");
    final InputStream templateIn = this.getClass().getClassLoader()
            .getResourceAsStream("resource-service-test-files/server.xml.tpl");

    final Set<Jvm> jvmSet = new HashSet<>();
    jvmSet.add(mock(Jvm.class));
    jvmSet.add(mock(Jvm.class));
    final Group mockGroup = mock(Group.class);
    when(mockGroup.getJvms()).thenReturn(jvmSet);
    when(Config.mockGroupPesistenceService.getGroup(eq("HEALTH CHECK 4.0"))).thenReturn(mockGroup);
    User mockUser = mock(User.class);
    when(mockUser.getId()).thenReturn("user-id");
    resourceService.createTemplate(metaDataIn, templateIn, "test-app-name", mockUser);
    verify(Config.mockJvmPersistenceService, new Times(2)).uploadJvmConfigTemplate(any(UploadJvmConfigTemplateRequest.class));
    verify(Config.mockGroupPesistenceService).populateGroupJvmTemplates(eq("HEALTH CHECK 4.0"), any(List.class));
}
项目:jwala    文件:ResourceServiceImplTest.java   
@Test
public void testCreateGroupedWebServersTemplate() {
    final InputStream metaDataIn = this.getClass().getClassLoader()
            .getResourceAsStream("resource-service-test-files/create-grouped-ws-template-test-metadata.json");
    final InputStream templateIn = this.getClass().getClassLoader()
            .getResourceAsStream("resource-service-test-files/httpd.conf.tpl");

    final Set<WebServer> webServerSet = new HashSet<>();
    webServerSet.add(mock(WebServer.class));
    webServerSet.add(mock(WebServer.class));
    final Group mockGroup = mock(Group.class);
    when(mockGroup.getWebServers()).thenReturn(webServerSet);
    when(mockGroup.getName()).thenReturn("HEALTH CHECK 4.0");
    when(Config.mockGroupPesistenceService.getGroupWithWebServers(eq("HEALTH CHECK 4.0"))).thenReturn(mockGroup);
    User mockUser = mock(User.class);
    when(mockUser.getId()).thenReturn("user-id");
    resourceService.createTemplate(metaDataIn, templateIn, "test-app-name", mockUser);
    verify(Config.mockWebServerPersistenceService, new Times(2)).uploadWebServerConfigTemplate(any(UploadWebServerTemplateRequest.class), eq("/conf/httpd.conf"), eq("user-id"));
    verify(Config.mockGroupPesistenceService).populateGroupWebServerTemplates(eq("HEALTH CHECK 4.0"), anyMap());
}
项目:development    文件:ServiceProvisioningPartnerServiceLocalBeanGrantResalePermissionTest.java   
@Test
public void grantResalePermission_BrokerRevShareAtMP() throws Exception {
    // given
    OfferingType resaleType = OfferingType.BROKER;
    setup(resaleType, false, false);

    // when
    resaleCopy = sppslBean.grantResalePermission(
            productTemplate.getProductId(), supplier.getOrganizationId(),
            grantee.getOrganizationId(), resaleType);

    // then
    verifyResaleCopy();

    InOrder inOrder = inOrder(ds);
    inOrder.verify(ds).persist(resaleCopy);
    ArgumentCaptor<CatalogEntry> argCatEntry = ArgumentCaptor
            .forClass(CatalogEntry.class);
    inOrder.verify(ds, new Times(2)).persist(argCatEntry.capture());
    verifyCreatedCatalogEntry(argCatEntry.getValue(), resaleType);

    verifyImageResource();
}
项目:perecoder    文件:TaskWorkerTest.java   
public void testFinishedTaskStatus() throws Throwable {
    final TaskDescriptor descriptor = createMockTaskDescriptor();
    final TaskWorker worker = new TaskWorker("owner", "author", descriptor, performer, eventPublisher);
    executorService.submit(worker).get();
    // check events
    ArgumentCaptor<TaskEvent> eventCaptor = ArgumentCaptor.forClass(TaskEvent.class);
    Mockito.verify(eventPublisher, new Times(5)).publishEvent(eventCaptor.capture());
    List<TaskEvent> events = eventCaptor.getAllValues();
    assertTaskProgressEvent(events.get(0), new TaskProgressEvent(worker, descriptor.getId(), null, new TaskProgress(TaskProgress.PENDING_STEP)));
    assertTaskExecutionEvent(events.get(1), new TaskExecutionEvent(worker, descriptor.getId(), null, TaskExecutionStatus.RUNNING));
    assertTaskProgressEvent(events.get(2), new TaskProgressEvent(worker, descriptor.getId(), null, new TaskProgress(TaskProgress.EXECUTING_STEP)));
    assertTaskProgressEvent(events.get(3), new TaskProgressEvent(worker, descriptor.getId(), null, null));
    assertTaskExecutionEvent(events.get(4), new TaskExecutionEvent(worker, descriptor.getId(), null, TaskExecutionStatus.READY));
    // check result
    assertTaskResult(worker.get(), TaskResultStatus.FINISHED);
}
项目:perecoder    文件:TaskWorkerTest.java   
public void testErrorTaskStatus() throws Throwable {
    final TaskDescriptor descriptor = createMockTaskDescriptor();
    final TaskWorker worker = new TaskWorker("owner", "author", descriptor, performer, eventPublisher);

    Mockito.doThrow(
            new UnsupportedOperationException("test error")
    ).when(performer).performTask(Mockito.any(ITaskProgress.class), Mockito.anyMapOf(String.class, Object.class));

    executorService.submit(worker).get();
    // check events
    ArgumentCaptor<TaskExecutionEvent> eventCaptor = ArgumentCaptor.forClass(TaskExecutionEvent.class);
    Mockito.verify(eventPublisher, new Times(5)).publishEvent(eventCaptor.capture());
    List<TaskExecutionEvent> events = eventCaptor.getAllValues();
    assertTaskProgressEvent(events.get(0), new TaskProgressEvent(worker, descriptor.getId(), null, new TaskProgress(TaskProgress.PENDING_STEP)));
    assertTaskExecutionEvent(events.get(1), new TaskExecutionEvent(worker, descriptor.getId(), null, TaskExecutionStatus.RUNNING));
    assertTaskProgressEvent(events.get(2), new TaskProgressEvent(worker, descriptor.getId(), null, new TaskProgress(TaskProgress.EXECUTING_STEP)));
    assertTaskProgressEvent(events.get(3), new TaskProgressEvent(worker, descriptor.getId(), null, null));
    assertTaskExecutionEvent(events.get(4), new TaskExecutionEvent(worker, descriptor.getId(), null, TaskExecutionStatus.READY));
    // check result
    TaskResult result = worker.get();
    assertTaskResult(result, TaskResultStatus.ERROR);
    assertEquals(result.getErrorMessage(), "test error");
}
项目:visearch-sdk-java    文件:ViSearchTest.java   
@Test
public void testWithoutAutoSolutionAction() throws InterruptedException {
    UploadSearchParams uploadSearchParams = new UploadSearchParams(new File("/tmp/test_image.jpg"));
    uploadSearchParams.setDedup(true);
    uploadSearchParams.setDedupThreshold(0.0001F);
    when(searchOperations.uploadSearch(any(UploadSearchParams.class))).then(new Answer<PagedSearchResult>() {
        @Override
        public PagedSearchResult answer(InvocationOnMock invocationOnMock) throws Throwable {
            PagedSearchResult result = new PagedSearchResult(null);
            result.setHeaders(ImmutableMap.of("X-Log-ID","11111"));
            return result;
        }
    });
    // with auto solution action
    visearch.uploadSearch(uploadSearchParams);
    verify(trackOperations, new Times(1)).sendEvent(any(Map.class));
    visearch.setEnableAutoSolutionActionTrack(false);

    // without auto solution action
    reset(trackOperations);
    visearch.uploadSearch(uploadSearchParams);
    verify(trackOperations, new Times(0)).sendEvent(any(Map.class));
}
项目:gocd    文件:TestArtifactPlanTest.java   
@Test
public void shouldSupportGlobPatternsInSourcePath() {
    ArtifactPlan artifactPlan = new ArtifactPlan(ArtifactType.unit, "**/*/a.log", "logs");
    MergedTestArtifactPlan testArtifactPlan = new MergedTestArtifactPlan(artifactPlan);

    File first = new File("target/test/report/a.log");
    File second = new File("target/test/test/a/b/a.log");

    first.mkdirs();
    second.mkdirs();

    testArtifactPlan.publish(mockArtifactPublisher, rootPath);

    verify(mockArtifactPublisher).upload(first, "logs/report");
    verify(mockArtifactPublisher).upload(second, "logs/test/a/b");
    verify(mockArtifactPublisher, new Times(2)).upload(any(File.class), eq("testoutput"));
}
项目:oscm    文件:ServiceProvisioningPartnerServiceLocalBeanGrantResalePermissionTest.java   
@Test
public void grantResalePermission_ResellerRevShareAtMP() throws Exception {
    // given
    OfferingType resaleType = OfferingType.RESELLER;
    setup(resaleType, false, false);

    // when
    resaleCopy = sppslBean.grantResalePermission(
            productTemplate.getProductId(), supplier.getOrganizationId(),
            grantee.getOrganizationId(), resaleType);

    // then
    verifyResaleCopy();

    InOrder inOrder = inOrder(ds);
    inOrder.verify(ds).persist(resaleCopy);
    ArgumentCaptor<CatalogEntry> argCatEntry = ArgumentCaptor
            .forClass(CatalogEntry.class);
    inOrder.verify(ds, new Times(2)).persist(argCatEntry.capture());
    verifyCreatedCatalogEntry(argCatEntry.getValue(), resaleType);

    verifyImageResource();

    verify(lsl).setLocalizedValues(resaleCopy.getKey(),
            LocalizedObjectTypes.RESELLER_PRICEMODEL_LICENSE,
            priceModelLicenses);

    verify(spsl).copyDefaultPaymentEnablement(resaleCopy, grantee);
}
项目:lepka    文件:LepkaImplTest.java   
@Test public void executeForward() throws Exception {

        Module module = modulesPool.findControllerForScreen(entry);
        Screen screen = new TestScreen2();

        lepka.execute(new Forward(screen));

        verify(executor, new Times(1)).openScreen(
                any(module.getClass()),
                any(screen.getClass()),
                anyBoolean());

        screen = new TestScreen4();
        module = modulesPool.findControllerForScreen(screen);

        lepka.execute(new Forward(screen));

        verify(executor, new Times(1)).openRouter(
                any(module.getClass()),
                anyBoolean());

        module = modulesPool.findControllerForScreen(screen);
        screen = new TestScreen3();

        lepka.execute(new Forward(screen));

        verify(executor, new Times(1)).openScreen(
                any(module.getClass()),
                any(screen.getClass()),
                anyBoolean());

        screen = new TestScreen5();
        module = modulesPool.findControllerForScreen(screen);

        lepka.execute(new Forward(screen));

        verify(executor, new Times(1)).openRouter(
                any(module.getClass()),
                anyBoolean());
    }
项目:singular-server    文件:SSOFilterTest.java   
@Test
public void testLogout() throws Exception {
    SSOFilter   filter      = spy(SSOFilter.class);
    FilterChain filterChain = mock(FilterChain.class);
    filter.init(filterConfig);

    request.setURL("/worklist/logout");
    filter.doFilter(request, response, filterChain);

    verify(filterChain, new Times(0)).doFilter(request, response);
}
项目:singular-server    文件:SSOFilterTest.java   
@Test
public void testExcluded() throws Exception {
    SSOFilter   filter      = spy(SSOFilter.class);
    FilterChain filterChain = mock(FilterChain.class);
    filter.init(filterConfig);

    request.setURL("/worklist/rest");
    filter.doFilter(request, response, filterChain);

    verify(filterChain, new Times(1)).doFilter(request, response);
}
项目:singular-server    文件:SSOFilterTest.java   
@Test
public void testAnother() throws Exception {
    SSOFilter   filter      = spy(SSOFilter.class);
    FilterChain filterChain = mock(FilterChain.class);
    filter.init(filterConfig);

    request.setURL("/worklist/whatever");
    filter.doFilter(request, response, filterChain);

    verify(filterChain, new Times(0)).doFilter(request, response);
}
项目:development    文件:ServiceProvisioningPartnerServiceLocalBeanGrantResalePermissionTest.java   
@Test
public void grantResalePermission_ResellerRevShareAtMP() throws Exception {
    // given
    OfferingType resaleType = OfferingType.RESELLER;
    setup(resaleType, false, false);

    // when
    resaleCopy = sppslBean.grantResalePermission(
            productTemplate.getProductId(), supplier.getOrganizationId(),
            grantee.getOrganizationId(), resaleType);

    // then
    verifyResaleCopy();

    InOrder inOrder = inOrder(ds);
    inOrder.verify(ds).persist(resaleCopy);
    ArgumentCaptor<CatalogEntry> argCatEntry = ArgumentCaptor
            .forClass(CatalogEntry.class);
    inOrder.verify(ds, new Times(2)).persist(argCatEntry.capture());
    verifyCreatedCatalogEntry(argCatEntry.getValue(), resaleType);

    verifyImageResource();

    verify(lsl).setLocalizedValues(resaleCopy.getKey(),
            LocalizedObjectTypes.RESELLER_PRICEMODEL_LICENSE,
            priceModelLicenses);

    verify(spsl).copyDefaultPaymentEnablement(resaleCopy, grantee);
}
项目:perecoder    文件:TaskWorkerTest.java   
public void testCancelTaskStatus() throws Throwable {
    final TaskDescriptor descriptor = createMockTaskDescriptor();
    final TaskWorker worker = new TaskWorker("owner", "author", descriptor, performer, eventPublisher);

    Mockito.doAnswer(
            new Answer() {
                @Override
                public Object answer(InvocationOnMock invocation) throws Throwable {
                    worker.cancel(true);
                    return Collections.<String, Object>emptyMap();
                }
            }
    ).when(performer).performTask(Mockito.any(ITaskProgress.class), Mockito.anyMapOf(String.class, Object.class));

    executorService.submit(worker).get();
    // check events
    ArgumentCaptor<TaskExecutionEvent> eventCaptor = ArgumentCaptor.forClass(TaskExecutionEvent.class);
    Mockito.verify(eventPublisher, new Times(6)).publishEvent(eventCaptor.capture());
    List<TaskExecutionEvent> events = eventCaptor.getAllValues();
    assertTaskProgressEvent(events.get(0), new TaskProgressEvent(worker, descriptor.getId(), null, new TaskProgress(TaskProgress.PENDING_STEP)));
    assertTaskExecutionEvent(events.get(1), new TaskExecutionEvent(worker, descriptor.getId(), null, TaskExecutionStatus.RUNNING));
    assertTaskProgressEvent(events.get(2), new TaskProgressEvent(worker, descriptor.getId(), null, new TaskProgress(TaskProgress.EXECUTING_STEP)));
    assertTaskExecutionEvent(events.get(3), new TaskExecutionEvent(worker, descriptor.getId(), null, TaskExecutionStatus.INTERRUPTING));
    assertTaskProgressEvent(events.get(4), new TaskProgressEvent(worker, descriptor.getId(), null, null));
    assertTaskExecutionEvent(events.get(5), new TaskExecutionEvent(worker, descriptor.getId(), null, TaskExecutionStatus.READY));
    // check result
    assertTaskResult(worker.get(), TaskResultStatus.CANCELED);
}
项目:visearch-sdk-java    文件:ViSearchTest.java   
@Test
public void testDiscoverSearchWithoutAutoSolutionAction() throws InterruptedException {
    UploadSearchParams uploadSearchParams = new UploadSearchParams(new File("/tmp/test_image.jpg"));
    when(searchOperations.discoverSearch(any(UploadSearchParams.class))).then(new Answer<PagedSearchResult>() {
        @Override
        public PagedSearchResult answer(InvocationOnMock invocationOnMock) throws Throwable {
            PagedSearchResult result = new PagedSearchResult(null);
            result.setHeaders(ImmutableMap.of("X-Log-ID","11111"));
            return result;
        }
    });
    // with auto solution action
    visearch.discoverSearch(uploadSearchParams);
    verify(trackOperations, new Times(1)).sendEvent(any(Map.class));
}
项目:visearch-sdk-java    文件:ViSearchTest.java   
@Test
public void testSimilarSearchWithoutAutoSolutionAction() throws InterruptedException {
    UploadSearchParams uploadSearchParams = new UploadSearchParams(new File("/tmp/test_image.jpg"));
    when(searchOperations.similarProductsSearch(any(UploadSearchParams.class))).then(new Answer<PagedSearchResult>() {
        @Override
        public PagedSearchResult answer(InvocationOnMock invocationOnMock) throws Throwable {
            PagedSearchResult result = new PagedSearchResult(null);
            result.setHeaders(ImmutableMap.of("X-Log-ID","11111"));
            return result;
        }
    });
    // with auto solution action
    visearch.similarProductsSearch(uploadSearchParams);
    verify(searchOperations, new Times(1)).similarProductsSearch(any(UploadSearchParams.class));
}
项目:astor    文件:TimeoutTest.java   
@Test
public void shouldCreateCorrectType() {
    Timeout t = new Timeout(25, 50, mode);

    assertCorrectMode(t.atLeastOnce(), Timeout.class, 50, 25, AtLeast.class);
    assertCorrectMode(t.atLeast(5), Timeout.class, 50, 25, AtLeast.class);
    assertCorrectMode(t.times(5), Timeout.class, 50, 25, Times.class);
    assertCorrectMode(t.never(), Timeout.class, 50, 25, Times.class);
    assertCorrectMode(t.only(), Timeout.class, 50, 25, Only.class);
    assertCorrectMode(t.atMost(10), Timeout.class, 50, 25, AtMost.class);
}
项目:astor    文件:TimeoutTest.java   
@Test
public void should_create_correctly_configured_timeout() {
    Timeout t = new Timeout(25, 50, mode);

    assertTimeoutCorrectlyConfigured(t.atLeastOnce(), Timeout.class, 50, 25, AtLeast.class);
    assertTimeoutCorrectlyConfigured(t.atLeast(5), Timeout.class, 50, 25, AtLeast.class);
    assertTimeoutCorrectlyConfigured(t.times(5), Timeout.class, 50, 25, Times.class);
    assertTimeoutCorrectlyConfigured(t.only(), Timeout.class, 50, 25, Only.class);
}
项目:gocd    文件:MaterialUpdateListenerFactoryTest.java   
@Test
public void shouldCreateCompetingConsumersForSuppliedQueue() throws Exception {
    when(systemEnvironment.getNumberOfMaterialCheckListener()).thenReturn(NUMBER_OF_CONSUMERS);

    MaterialUpdateListenerFactory factory = new MaterialUpdateListenerFactory(topic,configTopic, queue, configQueue,
            materialRepository, systemEnvironment, healthService, diskSpaceMonitor,
            transactionTemplate, dependencyMaterialUpdater, scmMaterialUpdater,
            packageMaterialUpdater, pluggableSCMMaterialUpdater, materialExpansionService, mduPerformanceLogger,
            dependencyMaterialQueue, null);
    factory.init();

    verify(queue, new Times(NUMBER_OF_CONSUMERS)).addListener(any(GoMessageListener.class));
}
项目:gocd    文件:MaterialUpdateListenerFactoryTest.java   
@Test
public void shouldCreateCompetingConsumersForSuppliedConfigQueue() throws Exception {
    when(systemEnvironment.getNumberOfConfigMaterialCheckListener()).thenReturn(NUMBER_OF_CONFIG_CONSUMERS);

    MaterialUpdateListenerFactory factory = new MaterialUpdateListenerFactory(topic,configTopic, queue, configQueue,
            materialRepository, systemEnvironment, healthService, diskSpaceMonitor,
            transactionTemplate, dependencyMaterialUpdater, scmMaterialUpdater,
            packageMaterialUpdater, pluggableSCMMaterialUpdater, materialExpansionService, mduPerformanceLogger,
            dependencyMaterialQueue, null);
    factory.init();

    verify(configQueue, new Times(NUMBER_OF_CONFIG_CONSUMERS)).addListener(any(GoMessageListener.class));
}
项目:gocd    文件:MaterialUpdateListenerFactoryTest.java   
@Test
public void shouldCreateCompetingConsumersForSuppliedDependencyMaterialQueue() throws Exception {
    int noOfDependencyMaterialCheckListeners = 3;

    when(systemEnvironment.getNumberOfDependencyMaterialUpdateListeners()).thenReturn(noOfDependencyMaterialCheckListeners);

    MaterialUpdateListenerFactory factory = new MaterialUpdateListenerFactory(topic,configTopic, queue, configQueue,
            materialRepository, systemEnvironment, healthService, diskSpaceMonitor,
            transactionTemplate, dependencyMaterialUpdater, scmMaterialUpdater,
            packageMaterialUpdater, pluggableSCMMaterialUpdater, materialExpansionService, mduPerformanceLogger,
            dependencyMaterialQueue, null);
    factory.init();

    verify(dependencyMaterialQueue, new Times(noOfDependencyMaterialCheckListeners)).addListener(any(GoMessageListener.class));
}
项目:osc-core    文件:JobQueuerTest.java   
@Test
@Ignore // this test is unstable
public void testPutJob() {

    final TaskGraph tg = new TaskGraph();
    tg.addTask(this.A);
    tg.addTask(this.B);
    tg.addTask(this.C, this.A);
    tg.addTask(this.D, this.A);

    final TaskGraph tg2 = new TaskGraph();
    tg2.addTask(this.A);
    tg2.addTask(this.B);
    tg2.addTask(this.C, this.A);
    tg2.addTask(this.D, this.A);

    final TaskGraph tg3 = new TaskGraph();
    tg3.addTask(this.A);
    tg3.addTask(this.B);
    tg3.addTask(this.C, this.A);
    tg3.addTask(this.D, this.A);

    @SuppressWarnings("unchecked")
    final List<String> mockList = mock(List.class);

    JobEngine.getEngine().addJobCompletionListener(new JobCompletionListener() {

        @Override
        public void completed(Job job) {
            mockList.add(job.getName());
        }
    });

    Runnable job1Runnable = new Runnable() {

        @Override
        public void run() {
            JobQueuer.getInstance().putJob(new JobRequest("Job-parallel-nested1", tg, false));
        }
    };

    Runnable job2Runnable = new Runnable() {

        @Override
        public void run() {
            JobQueuer.getInstance().putJob(new JobRequest("Job-parallel-nested2", tg2, false));
        }
    };
    Runnable job3Runnable = new Runnable() {

        @Override
        public void run() {
            JobQueuer.getInstance().putJob(new JobRequest("Job-parallel-nested3", tg3, false));
        }
    };
    new Thread(job1Runnable).start();

    try {
        Thread.sleep(1000);
    } catch (InterruptedException e1) {
        e1.printStackTrace();
    }

    new Thread(job2Runnable).start();
    new Thread(job3Runnable).start();

    InOrder inOrder = inOrder(mockList);
    verify(mockList, new Timeout(5000, new InOrderWrapper(new Times(1), (InOrderImpl) inOrder))).add(
            "Job-parallel-nested1");
    verify(mockList, new Timeout(5000, new InOrderWrapper(new Times(1), (InOrderImpl) inOrder))).add(
            "Job-parallel-nested2");
    verify(mockList, new Timeout(5000, new InOrderWrapper(new Times(1), (InOrderImpl) inOrder))).add(
            "Job-parallel-nested3");
    verifyNoMoreInteractions(mockList);

}
项目:actframework    文件:ControllerByteCodeScannerTest.java   
private void verifyNoRouting(String url, String controller, String action, H.Method... methods) {
    for (H.Method method : methods) {
        verify(mockRouter, new Times(0)).addMapping(method, url, "testapp.controller." + controller + "." + action, ACTION_ANNOTATION);
    }
}
项目:astor    文件:VerificationModeBuilder.java   
public Times inOrder() {
    return VerificationModeFactory.times(times);
}
项目:astor    文件:VerificationModeBuilder.java   
public Times inOrder() {
    return VerificationModeFactory.times(times);
}
项目:js-android-sdk    文件:ProxyJobSearchTaskTest.java   
private void thenCachedTaskShouldRequestHasNextFlag(Times times) throws Exception {
    verify(mJobSearchTask, times).hasNext();
}
项目:js-android-sdk    文件:ProxyJobSearchTaskTest.java   
private void thenCachedTaskShouldRequestLookup(Times times) throws ServiceException {
    verify(mJobSearchTask, times).nextLookup();
}
项目:gocd    文件:MaterialUpdateListenerTest.java   
@Test
public void shouldNotUpdateOnMessageWhenLowOnDisk() throws Exception {
    when(diskSpaceMonitor.isLowOnDisk()).thenReturn(true);
    materialUpdateListener.onMessage(new MaterialUpdateMessage(MATERIAL, 0));
    verify(updater, new Times(0)).updateMaterial(MATERIAL);
}