Java Code Examples for org.mockito.Mockito#doReturn()
The following examples show how to use
org.mockito.Mockito#doReturn() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hadoop File: TestQuorumJournalManagerUnit.java License: Apache License 2.0 | 4 votes |
static <V> Stubber futureReturns(V value) { ListenableFuture<V> ret = Futures.immediateFuture(value); return Mockito.doReturn(ret); }
Example 2
Source Project: hadoop File: TestQuorumJournalManagerUnit.java License: Apache License 2.0 | 4 votes |
static Stubber futureThrows(Throwable t) { ListenableFuture<?> ret = Futures.immediateFailedFuture(t); return Mockito.doReturn(ret); }
Example 3
Source Project: big-c File: TestQuorumJournalManagerUnit.java License: Apache License 2.0 | 4 votes |
static <V> Stubber futureReturns(V value) { ListenableFuture<V> ret = Futures.immediateFuture(value); return Mockito.doReturn(ret); }
Example 4
Source Project: big-c File: TestQuorumJournalManagerUnit.java License: Apache License 2.0 | 4 votes |
static Stubber futureThrows(Throwable t) { ListenableFuture<?> ret = Futures.immediateFailedFuture(t); return Mockito.doReturn(ret); }
Example 5
Source Project: mockito-java8 File: WithMockito.java License: Apache License 2.0 | 4 votes |
/** * Delegates call to {@link Mockito#doReturn(Object)}. */ default Stubber doReturn(Object toBeReturned) { return Mockito.doReturn(toBeReturned); }
Example 6
Source Project: mockito-java8 File: WithMockito.java License: Apache License 2.0 | 4 votes |
/** * Delegates call to {@link Mockito#doReturn(Object, Object...)}. */ default Stubber doReturn(Object toBeReturned, Object... toBeReturnedNext) { return Mockito.doReturn(toBeReturned, toBeReturnedNext); }
Example 7
Source Project: dexmaker File: ExtendedMockito.java License: Apache License 2.0 | 2 votes |
/** * Same as {@link Mockito#doReturn(Object)} but adds the ability to stub static method calls * via {@link StaticCapableStubber#when(MockedMethod)} and * {@link StaticCapableStubber#when(MockedVoidMethod)}. */ public static StaticCapableStubber doReturn(Object toBeReturned) { return new StaticCapableStubber(Mockito.doReturn(toBeReturned)); }
Example 8
Source Project: dexmaker File: ExtendedMockito.java License: Apache License 2.0 | 2 votes |
/** * Same as {@link Mockito#doReturn(Object, Object...)} but adds the ability to stub static * method calls via {@link StaticCapableStubber#when(MockedMethod)} and * {@link StaticCapableStubber#when(MockedVoidMethod)}. */ public static StaticCapableStubber doReturn(Object toBeReturned, Object... toBeReturnedNext) { return new StaticCapableStubber(Mockito.doReturn(toBeReturned, toBeReturnedNext)); }