Home
last modified time | relevance | path

Searched refs:thenThrow (Results 1 – 25 of 32) sorted by relevance

12

/external/mockito/src/main/java/org/mockito/internal/stubbing/
DBaseStubbing.java37 private OngoingStubbing<T> thenThrow(Throwable throwable) { in thenThrow() method in BaseStubbing
42 public OngoingStubbing<T> thenThrow(Throwable... throwables) { in thenThrow() method in BaseStubbing
44 return thenThrow((Throwable) null); in thenThrow()
49 stubbing = thenThrow(t); in thenThrow()
51 stubbing = stubbing.thenThrow(t); in thenThrow()
58 public OngoingStubbing<T> thenThrow(Class<? extends Throwable> throwableType) { in thenThrow() method in BaseStubbing
63 return thenThrow(newInstance(throwableType)); in thenThrow()
67 …public OngoingStubbing<T> thenThrow(Class<? extends Throwable> toBeThrown, Class<? extends Throwab… in thenThrow() method in BaseStubbing
69 return thenThrow((Class<Throwable>) null); in thenThrow()
71 OngoingStubbing<T> stubbing = thenThrow(toBeThrown); in thenThrow()
[all …]
/external/mockito/src/test/java/org/mockitousage/stubbing/
DStubbingWithThrowablesTest.java56 when(mock.add("")).thenThrow(new ExceptionOne()); in throws_same_exception_consecutively()
99 when(mock.add("throw")).thenThrow(expected); in shouldStubWithThrowable()
129 when(mock.size()).thenThrow(new ExceptionOne()); in shouldFailStubbingThrowableOnTheSameInvocationDueToAcceptableLimitation()
133 when(mock.size()).thenThrow(new ExceptionTwo()); in shouldFailStubbingThrowableOnTheSameInvocationDueToAcceptableLimitation()
141 when(reader.read()).thenThrow(ioException); in shouldAllowSettingCheckedException()
152 when(mock.add("quake")).thenThrow(error); in shouldAllowSettingError()
164 when(mock.add(null)).thenThrow((Exception) null); in shouldNotAllowNullExceptionType()
169 when(mock.add(null)).thenThrow(NaughtyException.class); in shouldInstantiateExceptionClassOnInteraction()
190 when(mock.add("monkey island")).thenThrow(new Exception()); in shouldNotAllowSettingInvalidCheckedException()
198 when(mock.add("monkey island")).thenThrow((Throwable) null); in shouldNotAllowSettingNullThrowable()
[all …]
DStubbingConsecutiveAnswersTest.java87 .thenThrow(new NullPointerException(), new RuntimeException()) in should_return_consecutive_value_and_throw_exceptions_set_by_shorten_return_methods()
89 .thenThrow(new IllegalArgumentException()); in should_return_consecutive_value_and_throw_exceptions_set_by_shorten_return_methods()
111 when(mock.simpleMethod()).thenThrow(new RuntimeException()) in should_throw_consecutively()
112 .thenThrow(new IllegalArgumentException()) in should_throw_consecutively()
113 .thenThrow(new NullPointerException()); in should_throw_consecutively()
138 when(mock.simpleMethod()).thenThrow(new RuntimeException(), in should_throw_consecutively_set_by_shorten_then_throw_method()
166 when(mock.simpleMethod()).thenThrow(IllegalArgumentException.class); in should_throw_classes()
183 when(mock.simpleMethod()).thenThrow(RuntimeException.class, in should_throw_consecutively_classes_set_by_shorten_then_throw_method()
211 .thenThrow(new IllegalArgumentException()) in should_mix_consecutive_returns_with_exceptions()
213 .thenThrow(new NullPointerException()) in should_mix_consecutive_returns_with_exceptions()
[all …]
DBasicStubbingTest.java63 when(mock.simpleMethod("one")).thenThrow(new RuntimeException()); in should_stubbing_not_be_treated_as_interaction()
/external/mockito/src/main/java/org/mockito/stubbing/
DOngoingStubbing.java89 OngoingStubbing<T> thenThrow(Throwable... throwables); in thenThrow() method
114 OngoingStubbing<T> thenThrow(Class<? extends Throwable> throwableType); in thenThrow() method
149 …OngoingStubbing<T> thenThrow(Class<? extends Throwable> toBeThrown, Class<? extends Throwable>... … in thenThrow() method
/external/mockito/src/test/java/org/mockitousage/
DCompilationWarningsTest.java40 … when(mock(IMethods.class).objectReturningMethodNoArgs()).thenThrow(new NullPointerException()); in no_warnings_for_most_common_api()
41 …when(mock(IMethods.class).objectReturningMethodNoArgs()).thenThrow(new NullPointerException(), new… in no_warnings_for_most_common_api()
42 … when(mock(IMethods.class).objectReturningMethodNoArgs()).thenThrow(NullPointerException.class); in no_warnings_for_most_common_api()
47 …when(mock(IMethods.class).objectReturningMethodNoArgs()).then(ignore()).thenThrow(new NullPointerE… in no_warnings_for_most_common_api()
48 …when(mock(IMethods.class).objectReturningMethodNoArgs()).then(ignore()).thenThrow(new NullPointerE… in no_warnings_for_most_common_api()
49 …when(mock(IMethods.class).objectReturningMethodNoArgs()).then(ignore()).thenThrow(NullPointerExcep… in no_warnings_for_most_common_api()
84 …when(mock(IMethods.class).objectReturningMethodNoArgs()).thenThrow(NullPointerException.class, Ill… in heap_pollution_JDK7plus_warning_avoided_BUT_now_unchecked_generic_array_creation_warnings_ON_JDK5plus_environment()
/external/mockito/src/test/java/org/mockitousage/misuse/
DInvalidUsageTest.java60 when(mock.simpleMethod()).thenThrow(new Exception()); in shouldNotAllowSettingInvalidCheckedException()
65 when(mock.simpleMethod()).thenThrow(new Throwable[] {null}); in shouldNotAllowSettingNullThrowable()
71 when(mock.simpleMethod()).thenThrow((Throwable) null); in shouldNotAllowSettingNullThrowableVararg()
76 when(mock.simpleMethod()).thenThrow(new RuntimeException(), null); in shouldNotAllowSettingNullConsecutiveThrowable()
/external/dagger2/javatests/dagger/producers/monitoring/
DTimingRecordersTest.java88 .thenThrow(new RuntimeException("monkey")); in singleRecorder_throwingProductionComponentTimingRecorderFactory()
117 .thenThrow(new RuntimeException("monkey")); in singleRecorder_throwingProductionComponentTimingRecorder()
205 .thenThrow(new RuntimeException("monkey")); in multipleRecorders_throwingProductionComponentTimingRecorderFactories()
207 .thenThrow(new RuntimeException("monkey")); in multipleRecorders_throwingProductionComponentTimingRecorderFactories()
209 .thenThrow(new RuntimeException("monkey")); in multipleRecorders_throwingProductionComponentTimingRecorderFactories()
253 .thenThrow(new RuntimeException("monkey")); in multipleRecorders_someThrowingProductionComponentTimingRecorderFactories()
255 .thenThrow(new RuntimeException("monkey")); in multipleRecorders_someThrowingProductionComponentTimingRecorderFactories()
/external/mockito/src/test/java/org/mockitousage/bugs/
DFillInStackTraceScenariosTest.java48 when(mock.simpleMethod()).thenThrow(new NullStackTraceException()); in avoids_NPE()
57 when(mock.simpleMethod()).thenThrow(new NewStackTraceException()); in uses_return_value_from_fillInStackTrace()
DNPEWhenMockingThrowablesTest.java28 when(mock.simpleMethod()).thenThrow(mock2); in shouldNotThrowNPE()
/external/mockito/src/test/java/org/mockitousage/stacktrace/
DStackTraceFilteringTest.java126 when(mock.oneArg(true)).thenThrow(new Exception()); in shouldFilterStackTraceWhenThrowingExceptionFromMockHandler()
135 when(mock.simpleMethod()).thenThrow(new RuntimeException()); in shouldShowProperExceptionStackTrace()
/external/mockito/src/main/java/org/mockito/
DBDDMockito.java172 return new BDDOngoingStubbingImpl<T>(mockitoOngoingStubbing.thenThrow(throwables)); in willThrow()
176 return new BDDOngoingStubbingImpl<T>(mockitoOngoingStubbing.thenThrow(throwableType)); in willThrow()
180 …return new BDDOngoingStubbingImpl<T>(mockitoOngoingStubbing.thenThrow(throwableType, throwableType… in willThrow()
/external/volley/src/test/java/com/android/volley/
DNetworkDispatcherTest.java101 when(mNetwork.performRequest(any(Request.class))).thenThrow(new ServerError()); in exceptionPostsError()
115 when(mNetwork.performRequest(any(Request.class))).thenThrow(new ServerError()); in exceptionNotifiesListener()
DRequestQueueIntegrationTest.java188 when(mMockNetwork.performRequest(request)).thenThrow(new VolleyError()); in add_requestFinishedListenerError()
/external/opencensus-java/exporters/trace/stackdriver/src/test/java/io/opencensus/exporter/trace/stackdriver/
DStackdriverV2ExporterHandlerExportTest.java58 .thenThrow(new RuntimeException("TraceServiceStub called")); in export()
/external/mockito/src/test/java/org/mockitousage/matchers/
DVerificationAndStubbingUsingMatchersTest.java34 when(three.simpleMethod(startsWith("test"))).thenThrow(new RuntimeException()); in shouldStubUsingMatchers()
/external/mockito/src/test/java/org/mockito/internal/configuration/plugins/
DPluginLoaderTest.java71 when(initializer.loadImpl(Foo.class)).thenThrow(cause); in fails_to_load_plugin()
DPluginFinderTest.java106 when(switcher.isEnabled(anyString())).thenThrow(new RuntimeException("Boo!")); in problems_loading_impl()
/external/mockito/src/test/java/org/mockitousage/basicapi/
DResetTest.java74 when(mock.simpleMethod("one")).thenThrow(new RuntimeException()); in shouldStubbingNotBeTreatedAsInteraction()
/external/grpc-grpc-java/core/src/test/java/io/grpc/internal/
DDnsNameResolverTest.java234 .thenThrow(new IOException("no addr")); in resolveAll_nullResourceResolver_addressFailure()
279 .thenThrow(new UnknownHostException("I really tried")); in resolveAll_onlyBalancers()
309 .thenThrow(new Exception("something like javax.naming.NamingException")); in resolveAll_balancerLookupFails()
353 when(mockAddressResolver.resolveAddress(Matchers.anyString())).thenThrow(new AssertionError()); in doNotResolveWhenProxyDetected()
/external/volley/src/test/java/com/android/volley/toolbox/
DAndroidAuthenticatorTest.java57 when(mFuture.getResult()).thenThrow(new AuthenticatorException("sadness!")); in failedGetAuthToken()
DAdaptedHttpStackTest.java53 .thenThrow(new ConnectTimeoutException()); in requestTimeout()
/external/downloader/src/test/java/com/google/android/downloader/
DDataUrlEngineTest.java90 when(mockByteChannel.write(any(ByteBuffer.class))).thenThrow(new IOException()); in executeRequest_writeError()
/external/mockito/src/test/java/org/mockitousage/annotation/
DMockInjectionUsingConstructorTest.java60 when(calculator.countArticles("new")).thenThrow(new IllegalArgumentException()); in innerMockShouldRaiseAnExceptionThatChangesOuterMockBehavior()
/external/grpc-grpc-java/auth/src/test/java/io/grpc/auth/
DGoogleAuthLibraryCallCredentialsTest.java189 when(credentials.getRequestMetadata(eq(expectedUri))).thenThrow(exception); in credentialsFailsWithIoException()
205 when(credentials.getRequestMetadata(eq(expectedUri))).thenThrow(exception); in credentialsFailsWithRuntimeException()

12