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


Java Times类代码示例

本文整理汇总了Java中org.mockito.internal.verification.Times的典型用法代码示例。如果您正苦于以下问题:Java Times类的具体用法?Java Times怎么用?Java Times使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: grantResalePermission_BrokerRevShareAtMP

import org.mockito.internal.verification.Times; //导入依赖的package包/类
@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();
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:24,代码来源:ServiceProvisioningPartnerServiceLocalBeanGrantResalePermissionTest.java

示例2: executeBack

import org.mockito.internal.verification.Times; //导入依赖的package包/类
@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();
    }
 
开发者ID:rostdev,项目名称:lepka,代码行数:19,代码来源:LepkaImplTest.java

示例3: testNetworkPartionMessage

import org.mockito.internal.verification.Times; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:22,代码来源:GMSJoinLeaveJUnitTest.java

示例4: testCreateGroupedJvmsTemplate

import org.mockito.internal.verification.Times; //导入依赖的package包/类
@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));
}
 
开发者ID:cerner,项目名称:jwala,代码行数:20,代码来源:ResourceServiceImplTest.java

示例5: testCreateGroupedWebServersTemplate

import org.mockito.internal.verification.Times; //导入依赖的package包/类
@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());
}
 
开发者ID:cerner,项目名称:jwala,代码行数:21,代码来源:ResourceServiceImplTest.java

示例6: testFinishedTaskStatus

import org.mockito.internal.verification.Times; //导入依赖的package包/类
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);
}
 
开发者ID:hflabs,项目名称:perecoder,代码行数:17,代码来源:TaskWorkerTest.java

示例7: testErrorTaskStatus

import org.mockito.internal.verification.Times; //导入依赖的package包/类
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");
}
 
开发者ID:hflabs,项目名称:perecoder,代码行数:24,代码来源:TaskWorkerTest.java

示例8: testWithoutAutoSolutionAction

import org.mockito.internal.verification.Times; //导入依赖的package包/类
@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));
}
 
开发者ID:visenze,项目名称:visearch-sdk-java,代码行数:24,代码来源:ViSearchTest.java

示例9: shouldSupportGlobPatternsInSourcePath

import org.mockito.internal.verification.Times; //导入依赖的package包/类
@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"));
}
 
开发者ID:gocd,项目名称:gocd,代码行数:18,代码来源:TestArtifactPlanTest.java

示例10: grantResalePermission_ResellerRevShareAtMP

import org.mockito.internal.verification.Times; //导入依赖的package包/类
@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);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:30,代码来源:ServiceProvisioningPartnerServiceLocalBeanGrantResalePermissionTest.java

示例11: executeForward

import org.mockito.internal.verification.Times; //导入依赖的package包/类
@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());
    }
 
开发者ID:rostdev,项目名称:lepka,代码行数:41,代码来源:LepkaImplTest.java

示例12: testLogout

import org.mockito.internal.verification.Times; //导入依赖的package包/类
@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);
}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:12,代码来源:SSOFilterTest.java

示例13: testExcluded

import org.mockito.internal.verification.Times; //导入依赖的package包/类
@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);
}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:12,代码来源:SSOFilterTest.java

示例14: testAnother

import org.mockito.internal.verification.Times; //导入依赖的package包/类
@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);
}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:12,代码来源:SSOFilterTest.java

示例15: testCancelTaskStatus

import org.mockito.internal.verification.Times; //导入依赖的package包/类
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);
}
 
开发者ID:hflabs,项目名称:perecoder,代码行数:29,代码来源:TaskWorkerTest.java


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