• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java GwtMockito类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: before

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void before() {
    GwtMockito.initMocks(this);

    when(viewItem.asWidget()).thenReturn(widget);

    when(styleNames.QP_ORDERED_ITEM()).thenReturn(QP_ORDERED_ITEM);
    when(styleNames.QP_ORDERED_ITEM_CORRECT()).thenReturn(QP_ORDERED_ITEM_CORRECT);
    when(styleNames.QP_ORDERED_ITEM_WRONG()).thenReturn(QP_ORDERED_ITEM_WRONG);
    when(styleNames.QP_ORDERED_ITEM_NONE()).thenReturn(QP_ORDERED_ITEM_NONE);
    when(styleNames.QP_ORDERED_ITEM_DEFAULT()).thenReturn(QP_ORDERED_ITEM_DEFAULT);
    when(styleNames.QP_ORDERED_ITEM_LOCKED()).thenReturn(QP_ORDERED_ITEM_LOCKED);
    when(styleNames.QP_ORDERED_ITEM_SELECTED()).thenReturn(QP_ORDERED_ITEM_SELECTED);

    instance = new OrderInteractionViewItemStylesImpl(styleNames);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:17,代码来源:OrderInteractionViewItemStylesImplJUnitTest.java


示例2: setUp

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setUp() {
    GwtMockito.initMocks(this);

    instance = (AbstractHTML5MediaExecutor) new HTML5VideoMediaExecutor(mediaEventMapper, html5MediaNativeListeners, uniqueIdGenerator);
    Video video = mock(Video.class);
    mediaBase = video;

    Map<String, String> sources = Maps.newHashMap();
    sources.put("http://dummy", "video/mp4");

    mediaConfiguration = mock(BaseMediaConfiguration.class);
    when(mediaConfiguration.getSources()).thenReturn(sources);
    when(mediaConfiguration.getMediaType()).thenReturn(MediaType.VIDEO);
    when(mediaConfiguration.getPoster()).thenReturn(POSTER_URL);
    when(mediaConfiguration.getHeight()).thenReturn(HEIGHT);
    when(mediaConfiguration.getWidth()).thenReturn(WIDTH);
    when(mediaConfiguration.getNarrationText()).thenReturn(NARRATION_TEXT);
    when(mediaConfiguration.isTemplate()).thenReturn(true);
    doReturn(track).when(video).addTrack(Matchers.any(TextTrackKind.class));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:22,代码来源:HTML5VideoMediaExecutorJUnitTest.java


示例3: setup

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setup() {
    imageAnchorMock = mock(ImageAnchor.class);
    GwtMockito.useProviderForType(ImageAnchor.class,
                                  new FakeProvider<ImageAnchor>() {
                                      @Override
                                      public ImageAnchor getFake(Class<?> aClass) {
                                          return imageAnchorMock;
                                      }
                                  });

    commentRow = new CommentRowWidget() {
        @Override
        SocialUserImageProvider getSocialUserImageProvider() {
            final SocialUserImageProvider provider = mock(SocialUserImageProvider.class);
            when(provider.getImageForSocialUser(any(SocialUser.class),
                                                any(
                                                        SocialUserImageRepositoryAPI.ImageSize.class))).thenReturn(mock(Image.class));
            return provider;
        }
    };
    commentRow.left = new FlowPanel();
    updateItem = new UpdateItem(new SocialActivitiesEvent(new SocialUser("dora"),
                                                          "",
                                                          new Date()));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:27,代码来源:CommentRowWidgetTest.java


示例4: setup

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setup() {
    GwtMockito.useProviderForType(SimpleEventBus.class,
                                  new FakeProvider() {
                                      @Override
                                      public Object getFake(Class aClass) {
                                          return simpleEventBus;
                                      }
                                  });

    ctx = mock(ModalConfigurationContext.class);
    cleanupPlaceRequest = mock(Command.class);
    editScreen = spy(new EditScreenFake(ctx,
                                        cleanupPlaceRequest));

    when(editScreen.addHiddenHandler(Mockito.any(ModalHiddenHandler.class))).thenAnswer(new Answer() {
        public Object answer(InvocationOnMock aInvocation) throws Throwable {
            modalHiddenHandler = (ModalHiddenHandler) aInvocation.getArguments()[0];
            return null;
        }
    });

    editScreen.realAddHiddenHandler();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:EditScreenTest.java


示例5: setUp

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setUp() {
  GwtMockito.initMocks(this);
  widget = new MyWidget() {
    @Override
    protected void initWidget(Widget widget) {
      // initWidget must be disarmed when testing widget to avoid
      // UnsatisfiedLinkErrors
    }

    @Override
    Element doStuffInJavaScript() {
      // JSNI methods  must be explicitly overridden or factored out to avoid
      // UnsatisfiedLinkErrors
      return null;
    }
  };
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:19,代码来源:MyWidgetTestWithoutRunner.java


示例6: setUp

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    // Mock The ListBox with loaded choices
    GwtMockito.useProviderForType(ListBox.class, new FakeProvider<ListBox>() {
        @Override
        public ListBox getFake(Class<?> aClass) {
            return choices;
        }
    });

    // Mock partially the AsyncPackageDataModelOracle
    incrementalDataModelServiceCaller = new CallerMock<>(incrementalDataModelService);
    validatorInstance = new MockInstanceImpl<>();
    oracle = spy(new AsyncPackageDataModelOracleImpl(incrementalDataModelServiceCaller, validatorInstance));

    // Mock partially the AsyncPackageDataModelOracleFactory
    doReturn(syncBeanDef).when(syncBeanManager).lookupBean(AsyncPackageDataModelOracle.class);
    doReturn(oracle).when(syncBeanDef).getInstance();
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:20,代码来源:RuleModellerConditionSelectorPopupTest.java


示例7: setUp

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    fromCollectWidget = new FromCollectCompositeFactPatternWidget(ruleModeller,
                                                                  eventBus,
                                                                  pattern);

    GwtMockito.useProviderForType(ListBox.class,
                                  new ListBoxFakeProvider());

    collectionTypes = new ArrayList<String>() {{
        add("ArrayList");
        add("HashSet");
    }};

    when(ruleModeller.getDataModelOracle()).thenReturn(oracle);
    when(oracle.getAvailableCollectionTypes()).thenReturn(collectionTypes);
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:18,代码来源:FromCollectCompositeFactPatternWidgetTest.java


示例8: setup

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setup() {
    GwtMockito.useProviderForType(TextBox.class, (aClass -> disabledTextBox));

    when(defaultValue.getDataType()).thenReturn(DataType.DataTypes.STRING);
    when(editingCol.getDefaultValue()).thenReturn(defaultValue);
    when(presenter.getModel()).thenReturn(model);
    when(presenter.getDataModelOracle()).thenReturn(oracle);
    when(plugin.patternWrapper()).thenReturn(patternWrapper);
    when(plugin.editingCol()).thenReturn(editingCol);
    when(plugin.getPresenter()).thenReturn(presenter);
    when(plugin.editingPattern()).thenReturn(pattern52);
    when(page.plugin()).thenReturn(plugin);
    when(model.getTableFormat()).thenReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY);

    doCallRealMethod().when(plugin).defaultValueWidget();
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:18,代码来源:ValueOptionsPageTest.java


示例9: setup

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setup() throws NoSuchFieldException, IllegalAccessException {
    GwtMockito.useProviderForType( WorkbenchResources.class,
                                   ( type ) -> null );

    lockManager = new GuidedDecisionTableLockManagerImpl();

    setLockManagerField( "lockService",
                         lockService );
    setLockManagerField( "lockInfo",
                         lockInfo );
    setLockManagerField( "changeTitleEvent",
                         changeTitleEvent );
    setLockManagerField( "user",
                         user );

    when( lockInfo.getFile() ).thenReturn( dtPath );
    when( user.getIdentifier() ).thenReturn( "user" );
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:20,代码来源:GuidedDecisionTableLockManagerImplTest.java


示例10: setUp

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setUp() {
    GwtMockito.initMocks(this);
    utilities = new ColumnUtilities(model,
                                    oracle);
    pattern = new Pattern52();
    column = new ConditionCol52();
    when(model.getPattern(column)).thenReturn(pattern);

    final Map<String, String> properties = new HashMap<>();
    if (valueList.compareTo(DATE_CONVERSION_VALUE_LIST) == 0) {
        properties.put(ApplicationPreferences.DATE_FORMAT,
                       "dd-MM-yyyy");
    } else {
        properties.put(ApplicationPreferences.DATE_FORMAT,
                       null);
    }
    ApplicationPreferences.setUp(properties);
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:20,代码来源:ColumnUtilitiesGetValueListTest.java


示例11: setup

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setup() {
    final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
    expressionEditorDefinitions.add(editorDefinition);

    doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
    doReturn(ExpressionType.LITERAL_EXPRESSION).when(editorDefinition).getType();
    doReturn(Optional.of(expression)).when(editorDefinition).getModelClass();
    doReturn(viewport).when(editorTypesContainer).getViewport();
    doReturn(transform).when(viewport).getTransform();
    doReturn(editorTypesContainerLocation).when(editorTypesContainer).getAbsoluteLocation();

    GwtMockito.useProviderForType(Group.class, type -> editorTypesContainer);

    this.renderer = new MockUndefinedExpressionColumnRenderer(expressionEditorDefinitionsSupplier,
                                                              gridWidget);
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:18,代码来源:UndefinedExpressionColumnRendererTest.java


示例12: setUp

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    GwtMockito.initMocks(this);
    customValueField = mock(TextBox.class);
    valueComboBox = mock(ComboBox.class);
    dataModel = mock(ComboBoxWidgetViewImpl.DataModel.class);
    view = mock(ComboBoxWidgetViewImpl.class);
    view.customValueField = customValueField;
    ;
    view.valueComboBox = valueComboBox;
    view.dataModel = dataModel;
    doCallRealMethod().when(view).init();
    doCallRealMethod().when(view).setValue(anyString());
    doCallRealMethod().when(view).setValue(anyString(),
                                           anyBoolean());
    doCallRealMethod().when(view).setComboBoxValues(any(ListBoxValues.class));
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:18,代码来源:ComboBoxWidgetViewImplTest.java


示例13: initTestCase

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void initTestCase() {
    GwtMockito.initMocks(this);
    assignWidgetOne = mock(AssignmentListItemWidgetViewImpl.class);
    assignWidgetTwo = mock(AssignmentListItemWidgetViewImpl.class);
    assignWidgetThree = mock(AssignmentListItemWidgetViewImpl.class);
    rows = new ArrayList<AssignmentRow>();
    rows.add(assignmentRowOne);
    rows.add(assignmentRowTwo);
    rows.add(assignmentRowThree);
    when(view.getAssignmentRows()).thenReturn(rows);
    when(view.getAssignmentsCount()).thenReturn(rows.size());
    when(view.getAssignmentWidget(0)).thenReturn(assignWidgetOne);
    when(view.getAssignmentWidget(1)).thenReturn(assignWidgetTwo);
    when(view.getAssignmentWidget(2)).thenReturn(assignWidgetThree);
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:17,代码来源:ActivityDataIOEditorWidgetTest.java


示例14: setUp

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setUp() {
    GwtMockito.initMocks(this);
    view = GWT.create(AssigneeEditorWidgetViewImpl.class);
    view.presenter = presenter;
    view.userSystemManager = userSystemManager;
    view.assigneeRows = assigneeRows;
    view.addButton = button;
    view.nameth = nameth;
    view.notification = notification;
    doCallRealMethod().when(view).setAssigneeRows(any(List.class));
    doCallRealMethod().when(view).init(any(AssigneeEditorWidgetView.Presenter.class));
    doCallRealMethod().when(view).handleAddButton(any(ClickEvent.class));
    doCallRealMethod().when(view).getAssigneeRows();
    doCallRealMethod().when(view).getAssigneeWidget(anyInt());
    doCallRealMethod().when(view).getAssigneeRowsCount();
    doCallRealMethod().when(view).getNames();
    doCallRealMethod().when(view).addItemToNames(anyObject());
    rows = new ArrayList<AssigneeRow>();
    rows.add(new AssigneeRow("user4",
                             null));
    rows.add(new AssigneeRow("user1",
                             null));
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:25,代码来源:AssigneeEditorWidgetViewImplTest.java


示例15: shouldUseFakeIfProvided

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Test
public void shouldUseFakeIfProvided() {
  GwtMockito.useProviderForType(
      TestRemoteService.class,
      new FakeProvider<TestRemoteServiceAsync>() {
        @Override
        public TestRemoteServiceAsync getFake(Class<?> type) {
          TestRemoteServiceAsync mock = mock(TestRemoteServiceAsync.class);
          doAnswer(returnSuccess("faked")).when(mock).doRpcWithoutArgs(anyAsyncCallback());
          return mock;
        }
      });
  MyWidget widget = new MyWidget();

  verify(widget.message).setText("faked");
}
 
开发者ID:google,项目名称:gwtmockito,代码行数:17,代码来源:GwtMockitoRpcWithoutGwtMockTest.java


示例16: gwtMockShouldTakePriorityOverFakes

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Test
public void gwtMockShouldTakePriorityOverFakes() {
  doAnswer(returnSuccess("mocked")).when(service).doRpcWithoutArgs(anyAsyncCallback());

  GwtMockito.useProviderForType(
      TestRemoteService.class,
      new FakeProvider<TestRemoteServiceAsync>() {
        @Override
        public TestRemoteServiceAsync getFake(Class<?> type) {
          TestRemoteServiceAsync mock = mock(TestRemoteServiceAsync.class);
          doAnswer(returnSuccess("faked")).when(mock).doRpcWithoutArgs(anyAsyncCallback());
          return mock;
        }
      });
  MyWidgetWithoutArgs widget = new MyWidgetWithoutArgs();

  verify(widget.message).setText("mocked");
}
 
开发者ID:google,项目名称:gwtmockito,代码行数:19,代码来源:GwtMockitoRpcTest.java


示例17: setUp

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setUp() {
    GwtMockito.initMocks(this);
    MediaBase mediaBase = mock(MediaBase.class);

    when(mediaEvent.getMediaWrapper()).thenReturn((MediaWrapper) mediaWrapper);
    when(mediaWrapper.getMediaObject()).thenReturn(mediaBase);
    when(mediaBase.getCurrentSrc()).thenReturn(FILE);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:10,代码来源:SoundJsMediaEventHandlerTest.java


示例18: setUp

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setUp() {
    GwtMockito.initMocks(this);
    instance = (AbstractHTML5MediaExecutor) new HTML5AudioMediaExecutor(mediaEventMapper, html5MediaNativeListeners);
    mediaBase = mock(Audio.class);

    Map<String, String> sources = Maps.newHashMap();
    sources.put("http://dummy", "audio/mp4");

    mediaConfiguration = mock(BaseMediaConfiguration.class);
    when(mediaConfiguration.getSources()).thenReturn(sources);
    when(mediaConfiguration.getMediaType()).thenReturn(MediaType.AUDIO);
    when(mediaConfiguration.isTemplate()).thenReturn(true);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:15,代码来源:HTML5AudioMediaExecutorJUnitTest.java


示例19: setup

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setup() {
  GwtMockito.initMocks(this);
  binder = GWT.create(UploadFileViewImpl.UploadFileViewBinder.class);
  locale = GWT.create(CoreLocalizationConstant.class);
  agentURLModifier = GWT.create(AgentURLModifier.class);
  UploadFilePresenter presenter = mock(UploadFilePresenter.class);
  view = new UploadFileViewImpl(binder, locale, agentURLModifier);
  view.setDelegate(presenter);
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:UploadFileViewImplTest.java


示例20: setup

import com.google.gwtmockito.GwtMockito; //导入依赖的package包/类
@Before
public void setup() throws Exception {
    mockTimer();

    GwtMockito.useProviderForType(WorkbenchResources.class,
                                  new FakeProvider<WorkbenchResources>() {

                                      @Override
                                      public WorkbenchResources getFake(Class<?> type) {
                                          return null;
                                      }
                                  });

    final Runnable reloadRunnable = new Runnable() {

        @Override
        public void run() {
            reloads++;
        }
    };

    final TitleProvider titleProvider = new TitleProvider() {

        @Override
        public String getTitle() {
            return "";
        }
    };

    target = new LockTarget(path,
                            widget,
                            new DefaultPlaceRequest("mockPlace"),
                            titleProvider,
                            reloadRunnable);

    lockManager.init(target);

    when(user.getIdentifier()).thenReturn("mockedUser");
    when(lockDemandDetector.isLockRequired(any(Event.class))).thenReturn(true);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:41,代码来源:LockManagerTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StringExpression类代码示例发布时间:2022-05-22
下一篇:
Java WallFilter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap