本文整理了Java中org.mockito.Mockito.anyDouble()
方法的一些代码示例,展示了Mockito.anyDouble()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mockito.anyDouble()
方法的具体详情如下:
包路径:org.mockito.Mockito
类名称:Mockito
方法名:anyDouble
暂无
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-case-mgmt-client
protected void setup() {
this.control = getBuilderControl();
this.control.init(canvasHandler);
when(canvasHandler.getElementAt(anyDouble(),
anyDouble())).thenReturn(Optional.empty());
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-widgets
@Before
public void setup() throws Exception {
when(viewSupplier.get()).thenReturn(view);
when(lienzoShapeGlyphRenderer.render(any(ShapeGlyph.class),
anyDouble(),
anyDouble())).thenReturn(new Group());
this.tested = new ElementShapeGlyphRenderer(lienzoShapeGlyphRenderer,
viewSupplier,
viewDestroyer);
}
代码示例来源:origin: kiegroup/appformer
@Test
public void testOnMinDateEditorChanged() {
SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);
SelectorSliderDisplayer.View view = presenter.getView();
presenter.draw();
reset(view);
presenter.onMinDateInputFocus();
verify(view).setSliderEnabled(false);
reset(view);
when(minDateInputEditor.getValue()).thenReturn(new Date());
presenter.onMinDateInputChange();
verify(view).showSlider(anyDouble(), anyDouble(), anyDouble(), anyDouble(), anyDouble());
verify(view).setSliderEnabled(true);
}
代码示例来源:origin: org.dashbuilder/dashbuilder-renderer-default
@Test
public void testDateSelector() {
SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);
SelectorSliderDisplayer.View view = presenter.getView();
DisplayerListener listener = mock(DisplayerListener.class);
presenter.addListener(listener);
presenter.draw();
verify(view).showSlider(anyDouble(), anyDouble(), anyDouble(), anyDouble(), anyDouble());
verify(view).margins(anyInt(), anyInt(), anyInt(), anyInt());
verify(view).setWidth(anyInt());
// Ensure no filter is executed if the range does not change
presenter.onSliderChange(1, 6);
reset(listener);
presenter.onSliderChange(1, 6);
verify(listener, never()).onFilterUpdate(eq(presenter), any(DataSetFilter.class), any(DataSetFilter.class));
}
代码示例来源:origin: org.dashbuilder/dashbuilder-renderer-default
@Test
public void testOnMaxDateEditorChanged() {
SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);
SelectorSliderDisplayer.View view = presenter.getView();
presenter.draw();
reset(view);
presenter.onMaxDateInputFocus();
verify(view).setSliderEnabled(false);
reset(view);
when(maxDateInputEditor.getValue()).thenReturn(new Date());
presenter.onMaxDateInputChange();
verify(view).showSlider(anyDouble(), anyDouble(), anyDouble(), anyDouble(), anyDouble());
verify(view).setSliderEnabled(true);
}
}
代码示例来源:origin: org.dashbuilder/dashbuilder-renderer-default
@Test
public void testOnMinDateEditorChanged() {
SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);
SelectorSliderDisplayer.View view = presenter.getView();
presenter.draw();
reset(view);
presenter.onMinDateInputFocus();
verify(view).setSliderEnabled(false);
reset(view);
when(minDateInputEditor.getValue()).thenReturn(new Date());
presenter.onMinDateInputChange();
verify(view).showSlider(anyDouble(), anyDouble(), anyDouble(), anyDouble(), anyDouble());
verify(view).setSliderEnabled(true);
}
代码示例来源:origin: kiegroup/appformer
@Test
public void testDateSelector() {
SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);
SelectorSliderDisplayer.View view = presenter.getView();
DisplayerListener listener = mock(DisplayerListener.class);
presenter.addListener(listener);
presenter.draw();
verify(view).showSlider(anyDouble(), anyDouble(), anyDouble(), anyDouble(), anyDouble());
verify(view).margins(anyInt(), anyInt(), anyInt(), anyInt());
verify(view).setWidth(anyInt());
// Ensure no filter is executed if the range does not change
presenter.onSliderChange(1, 6);
reset(listener);
presenter.onSliderChange(1, 6);
verify(listener, never()).onFilterUpdate(eq(presenter), any(DataSetFilter.class), any(DataSetFilter.class));
}
代码示例来源:origin: kiegroup/appformer
@Test
public void testOnMaxDateEditorChanged() {
SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);
SelectorSliderDisplayer.View view = presenter.getView();
presenter.draw();
reset(view);
presenter.onMaxDateInputFocus();
verify(view).setSliderEnabled(false);
reset(view);
when(maxDateInputEditor.getValue()).thenReturn(new Date());
presenter.onMaxDateInputChange();
verify(view).showSlider(anyDouble(), anyDouble(), anyDouble(), anyDouble(), anyDouble());
verify(view).setSliderEnabled(true);
}
}
代码示例来源:origin: kiegroup/drools-wb
@Test
public void checkSizedToParentHeight() {
@SuppressWarnings("unused")
final MultiValueDOMElementMock domElement = new MultiValueDOMElementMock(listBox,
gridLayer,
gridWidget,
false,
true);
verify(style,
never()).setWidth(anyDouble(),
any(Style.Unit.class));
verify(style).setHeight(eq(100.0),
eq(Style.Unit.PCT));
}
代码示例来源:origin: kiegroup/drools-wb
@Test
public void checkSizedToParentWidth() {
@SuppressWarnings("unused")
final MultiValueDOMElementMock domElement = new MultiValueDOMElementMock(listBox,
gridLayer,
gridWidget,
true,
false);
verify(style).setWidth(eq(100.0),
eq(Style.Unit.PCT));
verify(style,
never()).setHeight(anyDouble(),
any(Style.Unit.class));
}
代码示例来源:origin: org.uberfire/uberfire-wires-core-grids
@Test
public void testRefreshScrollPosition() {
final GridLienzoScrollPosition scrollPosition = mock(GridLienzoScrollPosition.class);
final Double internalScrollPanelWidth = 42d;
final Double internalScrollPanelHeight = 58d;
doReturn(internalScrollPanelWidth).when(scrollPosition).currentRelativeX();
doReturn(internalScrollPanelHeight).when(scrollPosition).currentRelativeY();
doReturn(scrollPosition).when(gridLienzoScrollHandler).scrollPosition();
doNothing().when(gridLienzoScrollHandler).synchronizeScrollSize();
doNothing().when(gridLienzoScrollHandler).setScrollBarsPosition(anyDouble(),
anyDouble());
gridLienzoScrollHandler.refreshScrollPosition();
verify(gridLienzoScrollHandler).synchronizeScrollSize();
verify(gridLienzoScrollHandler).setScrollBarsPosition(internalScrollPanelWidth,
internalScrollPanelHeight);
}
代码示例来源:origin: kiegroup/appformer
@Test
public void testRefreshScrollPosition() {
final GridLienzoScrollPosition scrollPosition = mock(GridLienzoScrollPosition.class);
final Double internalScrollPanelWidth = 42d;
final Double internalScrollPanelHeight = 58d;
doReturn(internalScrollPanelWidth).when(scrollPosition).currentRelativeX();
doReturn(internalScrollPanelHeight).when(scrollPosition).currentRelativeY();
doReturn(scrollPosition).when(gridLienzoScrollHandler).scrollPosition();
doNothing().when(gridLienzoScrollHandler).synchronizeScrollSize();
doNothing().when(gridLienzoScrollHandler).setScrollBarsPosition(anyDouble(),
anyDouble());
gridLienzoScrollHandler.refreshScrollPosition();
verify(gridLienzoScrollHandler).synchronizeScrollSize();
verify(gridLienzoScrollHandler).setScrollBarsPosition(internalScrollPanelWidth,
internalScrollPanelHeight);
}
代码示例来源:origin: kiegroup/drools-wb
@Test
public void testSetup() throws Exception {
final AbsolutePanel mainPanel = mock(AbsolutePanel.class);
final Transform transform = mock(Transform.class);
final Viewport viewport = mock(Viewport.class);
final Mediators mediators = mock(Mediators.class);
final Element element = mock(Element.class);
doReturn(transform).when(transform).scale(anyDouble());
doReturn(transform).when(view).newTransform();
doReturn(mediators).when(viewport).getMediators();
doReturn(element).when(mockGridPanel).getElement();
doReturn(mainPanel).when(mockGridPanel).getScrollPanel();
doReturn(viewport).when(mockGridPanel).getViewport();
view.setup();
verify(view).setupGridPanel();
verify(mediators).push(restrictedMousePanMediator);
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common
public Node newViewNode(String uuid,
Optional<Object> def,
final double x,
final double y,
final double w,
final double h) {
final Object definition = getDefIfPresent(uuid, def);
when(definitionUtils.buildBounds(eq(definition),
anyDouble(),
anyDouble()))
.thenReturn(Bounds.create(x, y, x + w, y + h));
final Node<Definition<Object>, Edge> result = nodeFactory.build(uuid,
definition);
execute(commandFactory.addNode(result));
when(graphIndex.getNode(eq(uuid))).thenReturn(result);
when(graphIndex.get(eq(uuid))).thenReturn(result);
return result;
}
代码示例来源:origin: Netflix/ndbench
@Test
public void testInvokingProcessMethodOnBulkWriteOperationSetsNewRateLimit() throws Exception {
NdBenchClient mockClientPlugin = mock(NdBenchClient.class);
when(mockClientPlugin.writeSingle(anyString())).thenReturn("foo");
when(mockClientPlugin.
autoTuneWriteRateLimit(anyDouble(), Collections.singletonList(anyString()), any(NdBenchMonitor.class))).
thenReturn(500D);
NdBenchMonitor mockMonitor = mock(NdBenchMonitor .class);
doNothing().when(mockMonitor).recordReadLatency(anyLong());
doNothing().when(mockMonitor).incWriteSuccess();
when(mockClientPlugin.writeSingle(anyString())).thenReturn("foo");
NdBenchDriver driver = new NdBenchDriver(config, ndBenchMonitor, dataGenerator, settableConfig);
WriteOperation writeOperation = new WriteOperation(mockClientPlugin);
List<String> keys = new ArrayList<>(1000);
for (int i = 0; i < 1000; i++) {
keys.add("keys" + i);
}
writeOperation.
process(driver, mockMonitor, keys, new AtomicReference<>(RateLimiter.create(100)), true);
int rateFromSettableConfig = settableConfig.getInteger(NdBenchConstants.WRITE_RATE_LIMIT_FULL_NAME);
assertEquals(rateFromSettableConfig , 500D, .001);
}
代码示例来源:origin: sixpack/sixpack-java
@Test
public void testPrefetchNetworkFailureReturnsControl() throws IOException {
Call<ParticipateResponse> mockCall = mock(Call.class);
when(mockCall.execute()).thenThrow(new IOException());
when(mockApi.participate(Matchers.<Experiment>anyObject(), Matchers.<List<Alternative>>anyObject(), Matchers.<Alternative>anyObject(), anyDouble(), eq(true)))
.thenReturn(mockCall);
Sixpack sixpack = new Sixpack(mockApi);
Alternative greenAlternative = new Alternative("green");
Alternative redAlternative = new Alternative("red");
Experiment experiment = new ExperimentBuilder(sixpack)
.withName("test-experience")
.withAlternatives(greenAlternative, redAlternative)
.build();
PrefetchedExperiment prefetched = sixpack.prefetch(experiment);
assertEquals(new PrefetchedExperiment(sixpack, experiment, greenAlternative), prefetched);
}
代码示例来源:origin: sixpack/sixpack-java
@Test
public void testParticipateNetworkFailureReturnsControl() throws IOException {
Call<ParticipateResponse> mockCall = mock(Call.class);
when(mockCall.execute()).thenThrow(new IOException());
when(mockApi.participate(Matchers.<Experiment>anyObject(), Matchers.<List<Alternative>>anyObject(), Matchers.<Alternative>anyObject(), anyDouble(), Matchers.<Boolean>eq(null)))
.thenReturn(mockCall);
Sixpack sixpack = new Sixpack(mockApi);
Alternative greenAlternative = new Alternative("green");
Alternative redAlternative = new Alternative("red");
Experiment experiment = new ExperimentBuilder(sixpack)
.withName("test-experience")
.withAlternatives(greenAlternative, redAlternative)
.build();
ParticipatingExperiment participatingExperiment = sixpack.participate(experiment);
assertEquals(new ParticipatingExperiment(sixpack, experiment, greenAlternative), participatingExperiment);
}
代码示例来源:origin: sixpack/sixpack-java
@Test
public void testParticipateFailedResponseReturnsControl() throws IOException {
Call<ParticipateResponse> mockCall = mock(Call.class);
when(mockCall.execute()).thenReturn(retrofit2.Response.<ParticipateResponse>error(404, ResponseBody.create(MediaType.parse("application/json"), "{}")));
when(mockApi.participate(Matchers.<Experiment>anyObject(), Matchers.<List<Alternative>>anyObject(), Matchers.<Alternative>anyObject(), anyDouble(), Matchers.<Boolean>eq(null)))
.thenReturn(mockCall);
Sixpack sixpack = new Sixpack(mockApi);
Alternative greenAlternative = new Alternative("green");
Alternative redAlternative = new Alternative("red");
Experiment experiment = new ExperimentBuilder(sixpack)
.withName("test-experience")
.withAlternatives(greenAlternative, redAlternative)
.build();
ParticipatingExperiment participatingExperiment = sixpack.participate(experiment);
assertEquals(new ParticipatingExperiment(sixpack, experiment, greenAlternative), participatingExperiment);
}
代码示例来源:origin: sixpack/sixpack-java
@Test
public void testPrefetchFailedResponseReturnsControl() throws IOException {
Call<ParticipateResponse> mockCall = mock(Call.class);
when(mockCall.execute()).thenReturn(retrofit2.Response.<ParticipateResponse>error(404, ResponseBody.create(MediaType.parse("application/json"), "{}")));
when(mockApi.participate(Matchers.<Experiment>anyObject(), Matchers.<List<Alternative>>anyObject(), Matchers.<Alternative>anyObject(), anyDouble(), eq(true)))
.thenReturn(mockCall);
Sixpack sixpack = new Sixpack(mockApi);
Alternative greenAlternative = new Alternative("green");
Alternative redAlternative = new Alternative("red");
Experiment experiment = new ExperimentBuilder(sixpack)
.withName("test-experience")
.withAlternatives(greenAlternative, redAlternative)
.build();
PrefetchedExperiment prefetched = sixpack.prefetch(experiment);
assertEquals(new PrefetchedExperiment(sixpack, experiment, greenAlternative), prefetched);
}
代码示例来源:origin: sixpack/sixpack-java
@Test
public void testParticipateInSuccess() throws IOException {
ParticipateResponse response = new ParticipateResponse();
AlternativeName name = new AlternativeName();
name.name = "red";
response.alternative = name;
Call<ParticipateResponse> call = mock(Call.class);
when(call.execute()).thenReturn(retrofit2.Response.success(response));
when(mockApi.participate(Matchers.<Experiment>anyObject(), Matchers.<List<Alternative>>anyObject(), Matchers.<Alternative>anyObject(), anyDouble(), Matchers.<Boolean>eq(null)))
.thenReturn(call);
Sixpack sixpack = new Sixpack(mockApi);
Alternative greenAlternative = new Alternative("green");
Alternative redAlternative = new Alternative("red");
Experiment experiment = new ExperimentBuilder(sixpack)
.withName("test-experience")
.withAlternatives(greenAlternative, redAlternative)
.build();
ParticipatingExperiment participatingExperiment = sixpack.participate(experiment);
assertEquals(new ParticipatingExperiment(sixpack, experiment, redAlternative), participatingExperiment);
}
内容来源于网络,如有侵权,请联系作者删除!