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


Java GwtMockito类代码示例

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


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


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