本文整理汇总了Java中com.google.gwtmockito.GwtMockito.initMocks方法的典型用法代码示例。如果您正苦于以下问题:Java GwtMockito.initMocks方法的具体用法?Java GwtMockito.initMocks怎么用?Java GwtMockito.initMocks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwtmockito.GwtMockito
的用法示例。
在下文中一共展示了GwtMockito.initMocks方法的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));
}
示例3: 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;
}
};
}
示例4: 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);
}
示例5: 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));
}
示例6: 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);
}
示例7: 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));
}
示例8: 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);
}
示例9: 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);
}
示例10: 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);
}
示例11: init
import com.google.gwtmockito.GwtMockito; //导入方法依赖的package包/类
@Before
public void init() {
GwtMockito.initMocks(this);
btn = GWT.create(CopyRepositoryUrlBtn.class);
doCallRealMethod().when(btn).init(anyBoolean(),
anyString(),
anyString());
}
示例12: setUp
import com.google.gwtmockito.GwtMockito; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
GwtMockito.initMocks(this);
GwtMockito.useProviderForType(ViewEngine.WidgetBindingMap.class, new FakeProvider<Object>() {
@Override
public Object getFake(Class<?> type) {
return new WidgetBindingMapForTest();
}
});
}
示例13: init
import com.google.gwtmockito.GwtMockito; //导入方法依赖的package包/类
@Before
public void init() {
GwtMockito.initMocks(this);
textBox = GWT.create(VariableNameTextBox.class);
doCallRealMethod().when(textBox).setRegExp(anyString(),
anyString(),
anyString());
doCallRealMethod().when(textBox).setInvalidValues(anySet(),
anyBoolean(),
anyString());
doCallRealMethod().when(textBox).isValidValue(anyString(),
anyBoolean());
doCallRealMethod().when(textBox).setText(anyString());
doCallRealMethod().when(textBox).testForInvalidValue(anyString());
doCallRealMethod().when(textBox).makeValidValue(anyString());
doCallRealMethod().when(textBox).getInvalidCharsInName(anyString());
doCallRealMethod().when(textBox).isValidChar(anyChar());
doCallRealMethod().when(textBox).setup();
doCallRealMethod().when(textBox).addBlurHandler(any(BlurHandler.class));
doCallRealMethod().when(textBox).addKeyPressHandler(any(KeyPressHandler.class));
textBox.setRegExp(ALPHA_NUM_REGEXP,
ERROR_REMOVED,
ERROR_TYPED);
INVALID_VALUES.clear();
INVALID_VALUES.add("abc");
INVALID_VALUES.add("CdE");
INVALID_VALUES.add("a#$%1");
textBox.setInvalidValues(INVALID_VALUES,
caseSensitive,
ERROR_MESSAGE);
}
示例14: setUp
import com.google.gwtmockito.GwtMockito; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
GwtMockito.initMocks(this);
customDataType = mock(TextBox.class);
dataType = mock(ValueListBox.class);
dataTypeComboBox = mock(ComboBox.class);
processVarComboBox = mock(ComboBox.class);
view = mock(VariableListItemWidgetViewImpl.class);
view.variableRow = variableRow;
view.name = name;
view.deleteButton = deleteButton;
view.customDataType = customDataType;
view.dataType = dataType;
view.dataTypeComboBox = dataTypeComboBox;
view.notification = notification;
doCallRealMethod().when(view).init();
doCallRealMethod().when(view).getCustomDataType();
doCallRealMethod().when(view).setCustomDataType(anyString());
doCallRealMethod().when(view).getModel();
doCallRealMethod().when(view).setModel(any(VariableRow.class));
doCallRealMethod().when(view).getModelValue(any(ValueListBox.class));
doCallRealMethod().when(view).setTextBoxModelValue(any(TextBox.class),
anyString());
doCallRealMethod().when(view).setListBoxModelValue(any(ValueListBox.class),
anyString());
doCallRealMethod().when(view).getDataTypeDisplayName();
doCallRealMethod().when(view).setDataTypeDisplayName(anyString());
doCallRealMethod().when(view).getVariableType();
doCallRealMethod().when(view).setParentWidget(any(VariablesEditorWidgetView.Presenter.class));
doCallRealMethod().when(view).isDuplicateName(anyString());
doCallRealMethod().when(view).handleDeleteButton(any(ClickEvent.class));
VariableRow row = new VariableRow();
doReturn(row).when(variableRow).getModel();
}
示例15: initTestCase
import com.google.gwtmockito.GwtMockito; //导入方法依赖的package包/类
@Before
public void initTestCase() {
GwtMockito.initMocks(this);
dataType = mock(ValueListBox.class);
customDataType = mock(TextBox.class);
dataTypeComboBox = mock(ComboBox.class);
widget = GWT.create(VariableListItemWidgetViewImpl.class);
VariableRow variableRow = new VariableRow();
widget.dataType = dataType;
widget.customDataType = customDataType;
widget.dataTypeComboBox = dataTypeComboBox;
widget.name = name;
widget.deleteButton = deleteButton;
widget.variableRow = variable;
Mockito.doCallRealMethod().when(widget).setTextBoxModelValue(any(TextBox.class),
anyString());
Mockito.doCallRealMethod().when(widget).setListBoxModelValue(any(ValueListBox.class),
anyString());
Mockito.doCallRealMethod().when(widget).getModelValue(any(ValueListBox.class));
Mockito.doCallRealMethod().when(widget).setDataTypeDisplayName(anyString());
Mockito.doCallRealMethod().when(widget).getDataTypeDisplayName();
Mockito.doCallRealMethod().when(widget).setCustomDataType(anyString());
Mockito.doCallRealMethod().when(widget).getCustomDataType();
Mockito.doCallRealMethod().when(widget).setDataTypes(any(ListBoxValues.class));
Mockito.doCallRealMethod().when(widget).init();
Mockito.doCallRealMethod().when(widget).setModel(any(VariableRow.class));
when(widget.getModel()).thenReturn(variableRow);
}