Home
last modified time | relevance | path

Searched refs:spy (Results 1 – 25 of 73) sorted by relevance

123

/external/mockito/src/test/java/org/mockitousage/spies/
DSpyingOnRealObjectsTest.java29 List<String> spy = Mockito.spy(list); field in SpyingOnRealObjectsTest
33 spy.add("one"); in shouldVerify()
34 spy.add("two"); in shouldVerify()
36 assertEquals("one", spy.get(0)); in shouldVerify()
37 assertEquals("two", spy.get(1)); in shouldVerify()
39 verify(spy).add("one"); in shouldVerify()
40 verify(spy).add("two"); in shouldVerify()
46 spy(new Object()); in shouldBeAbleToMockObjectBecauseWhyNot()
51 spy.add("one"); in shouldStub()
52 when(spy.get(0)) in shouldStub()
[all …]
DPartialMockingWithSpiesTest.java16 import static org.mockito.Mockito.spy;
69 Person spy = spy(new Person()); field in PartialMockingWithSpiesTest
74 String name = spy.getName(); in shouldCallRealMethdsEvenDelegatedToOtherSelfMethod()
83 when(spy.getName()).thenReturn("foo"); in shouldAllowStubbingOfMethodsThatDelegateToOtherMethods()
86 assertEquals("foo", spy.getName()); in shouldAllowStubbingOfMethodsThatDelegateToOtherMethods()
93 .when(spy).getNameButDelegateToMethodThatThrows(); in shouldAllowStubbingWithThrowablesMethodsThatDelegateToOtherMethods()
97 spy.getNameButDelegateToMethodThatThrows(); in shouldAllowStubbingWithThrowablesMethodsThatDelegateToOtherMethods()
108 spy.getNameButDelegateToMethodThatThrows(); in shouldStackTraceGetFilteredOnUserExceptions()
122 spy.getNameButDelegateToMethodThatThrows(); in verifyTheStackTrace()
128 spy.getName(); in shouldVerify()
[all …]
DStubbingSpiesDoesNotYieldNPETest.java14 import static org.mockito.Mockito.spy;
35 Foo spy = spy(foo); in shouldNotThrowNPE() local
37 spy.len(anyString()); in shouldNotThrowNPE()
38 spy.size(anyMap()); in shouldNotThrowNPE()
39 spy.size(anyList()); in shouldNotThrowNPE()
40 spy.size(anyCollection()); in shouldNotThrowNPE()
41 spy.size(anySet()); in shouldNotThrowNPE()
/external/clang/tools/scan-build-py/tests/unit/
Dtest_runner.py134 spy = Spy()
135 result = sut.run_analyzer(opts, spy.call)
136 return (result, spy.arg)
212 spy = Spy()
214 self.assertEqual(spy.success,
215 sut.filter_debug_flags(opts, spy.call))
216 return spy.arg['flags']
224 spy = Spy()
225 self.assertEqual(spy.success,
226 sut.set_file_path_relative(input, spy.call))
[all …]
/external/mockito/src/test/java/org/mockitousage/annotation/
DSpyInjectionTest.java18 @Spy List<Object> spy = new LinkedList<Object>(); field in SpyInjectionTest
22 private List<?> spy; field in SpyInjectionTest.HasSpy
23 public void setSpy(List<?> spy) { in setSpy() argument
24 this.spy = spy; in setSpy()
30 MockUtil.isMock(hasSpy.spy); in shouldDoStuff()
DInjectionOfInlinedMockDeclarationTest.java15 import static org.mockito.Mockito.spy;
21 @InjectMocks private Receiver spiedReceiver = spy(new Receiver());
26 private Tuner tuner = spy(new Tuner());
/external/guava/guava-tests/test/com/google/common/io/
DAppendableWriterTest.java93 SpyAppendable spy = new SpyAppendable(); in testCloseFlush() local
94 Writer writer = new AppendableWriter(spy); in testCloseFlush()
97 assertFalse(spy.flushed); in testCloseFlush()
98 assertFalse(spy.closed); in testCloseFlush()
101 assertTrue(spy.flushed); in testCloseFlush()
102 assertFalse(spy.closed); in testCloseFlush()
105 assertTrue(spy.flushed); in testCloseFlush()
106 assertTrue(spy.closed); in testCloseFlush()
/external/guava/android/guava-tests/test/com/google/common/io/
DAppendableWriterTest.java93 SpyAppendable spy = new SpyAppendable(); in testCloseFlush() local
94 Writer writer = new AppendableWriter(spy); in testCloseFlush()
97 assertFalse(spy.flushed); in testCloseFlush()
98 assertFalse(spy.closed); in testCloseFlush()
101 assertTrue(spy.flushed); in testCloseFlush()
102 assertFalse(spy.closed); in testCloseFlush()
105 assertTrue(spy.flushed); in testCloseFlush()
106 assertTrue(spy.closed); in testCloseFlush()
/external/dexmaker/dexmaker-mockito-tests/src/main/java/com/android/dx/mockito/tests/
DGeneralMocking.java27 import static org.mockito.Mockito.spy;
95 TestClass t = spy(originalT); in spyClass()
108 TestClass t = spy(TestClass.class); in spyNewClass()
138 TestClass t = spy(TestClass.class); in spyThrowingMethod()
152 TestClass t = spy(TestClass.class); in spyErrorMethod()
164 TestClass t = spy(TestClass.class); in spyExceptingMethod()
219 TestClass t = spy(TestClass.class); in callClassWithoutMatcher()
229 TestClass t = spy(TestClass.class); in callClassWithMatcher()
239 TestClass t = spy(TestClass.class); in callClassWithNullMatcher()
249 TestSubClass t = spy(TestSubClass.class); in callSubClassWithoutMatcher()
[all …]
DBlacklistedApis.java24 import static org.mockito.Mockito.spy;
73 FrameLayout parent = spy(new FrameLayout(targetContext)); in callBlacklistedPublicMethodRealMethod()
104 FrameLayout parent = spy(new FrameLayout(targetContext)); in copyBlacklistedFields()
124 spy(new View(InstrumentationRegistry.getTargetContext(), null)); in cannotCallBlackListedAfterSpying()
151 CallBlackListedMethod t = spy(new CallBlackListedMethod()); in spiesCannotBeUsedToCallHiddenMethods()
/external/mockito/src/test/java/org/mockitousage/bugs/
DImplementationOfGenericAbstractMethodNotInvokedOnSpyTest.java10 import static org.mockito.Mockito.spy;
30 GenericAbstract<Number> spy = spy(new ImplementsGenericMethodOfAbstract<Number>()); in should_invoke_method_to_implement() local
32 assertThat(spy.public_method(73L)).isEqualTo("concrete value"); in should_invoke_method_to_implement()
/external/guava/android/guava-tests/test/com/google/common/util/concurrent/
DJdkFutureAdaptersTest.java81 ExecutorSpy spy = new ExecutorSpy(directExecutor()); in testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone() local
82 ListenableFuture<String> listenableFuture = listenInPoolThread(abstractFuture, spy); in testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone()
87 assertFalse(spy.wasExecuted); in testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone()
98 assertFalse(spy.wasExecuted); in testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone()
107 ExecutorSpy spy = new ExecutorSpy(executorService); in testListenInPoolThreadUsesGivenExecutor() local
108 ListenableFuture<String> listenableFuture = listenInPoolThread(abstractFuture, spy); in testListenInPoolThreadUsesGivenExecutor()
113 assertFalse(spy.wasExecuted); in testListenInPoolThreadUsesGivenExecutor()
122 assertTrue(spy.wasExecuted); in testListenInPoolThreadUsesGivenExecutor()
/external/guava/guava-tests/test/com/google/common/util/concurrent/
DJdkFutureAdaptersTest.java81 ExecutorSpy spy = new ExecutorSpy(directExecutor()); in testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone() local
82 ListenableFuture<String> listenableFuture = listenInPoolThread(abstractFuture, spy); in testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone()
87 assertFalse(spy.wasExecuted); in testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone()
98 assertFalse(spy.wasExecuted); in testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone()
107 ExecutorSpy spy = new ExecutorSpy(executorService); in testListenInPoolThreadUsesGivenExecutor() local
108 ListenableFuture<String> listenableFuture = listenInPoolThread(abstractFuture, spy); in testListenInPoolThreadUsesGivenExecutor()
113 assertFalse(spy.wasExecuted); in testListenInPoolThreadUsesGivenExecutor()
122 assertTrue(spy.wasExecuted); in testListenInPoolThreadUsesGivenExecutor()
/external/dexmaker/dexmaker-mockito-inline-extended-tests/src/main/java/com/android/dx/mockito/inline/extended/tests/
DSpyOn.java21 import static com.android.dx.mockito.inline.extended.ExtendedMockito.spy;
83 TestClass spy = spy(original); in spiesAreUsuallyClones() local
84 assertSame(marker, spy.field); in spiesAreUsuallyClones()
86 assertNotSame(original, spy); in spiesAreUsuallyClones()
/external/dexmaker/dexmaker-mockito-inline-tests/src/main/java/com/android/dx/mockito/inline/tests/
DMockNonPublic.java24 import static org.mockito.Mockito.spy;
41 SingleMethodInterface c = (SingleMethodInterface) spy(clazz); in spySingleMethod()
49 T c = spy(original); in spyWrappedSingleMethod()
79 DualMethodInterface c = (DualMethodInterface) spy(clazz); in spyDualMethod()
93 T c = spy(original); in spyWrappedDualMethod()
300 ClassWithPackagePrivateMethod c = spy(ClassWithPackagePrivateMethod.class); in spyClassWithPackagePrivateMethod()
310 ClassWithPackagePrivateMethod c = spy(original); in spyWrappedClassWithPackagePrivateMethod()
370 SubOfAbstractClassWithPackagePrivateMethod c = spy in spySubOfAbstractClassWithPackagePrivateMethod()
388 SubOfAbstractClassWithPackagePrivateMethod c = spy(original); in spyWrappedSubOfAbstractClassWithPackagePrivateMethod()
/external/mockito/src/test/java/org/mockitousage/constructor/
DCreatingMocksWithConstructorTest.java20 import static org.mockito.Mockito.spy;
60 AbstractMessage mock = spy(AbstractMessage.class); in can_spy_abstract_classes()
130 spy(HasConstructor.class); in exception_message_when_constructor_not_found()
257 spy(IMethods.class); in mocking_interfaces_with_constructor()
281 AbstractThing thing = spy(AbstractThing.class); in abstract_method_returns_default()
287 AbstractThing thing = spy(AbstractThing.class); in abstract_method_stubbed()
294 List<?> list = spy(List.class); in interface_method_stubbed()
307 SomeConcreteClass<Integer> testBug = spy(new SomeConcreteClass<Integer>()); in handles_bridge_methods_correctly()
/external/mockito/src/test/java/org/mockitousage/strictness/
DStrictnessPerStubbingTest.java27 import static org.mockito.Mockito.spy;
188 final Counter spy = spy(Counter.class); in doNothing_syntax() local
189 lenient().doNothing().when(spy).scream("1"); in doNothing_syntax()
195 spy.scream("2"); in doNothing_syntax()
200 spy.scream("1"); in doNothing_syntax()
/external/grpc-grpc-java/netty/src/test/java/io/grpc/netty/
DMaxConnectionIdleManagerTest.java22 import static org.mockito.Mockito.spy;
57 spy(new TestMaxConnectionIdleManager(123L, ticker)); in maxIdleReached()
69 spy(new TestMaxConnectionIdleManager(123L, ticker)); in maxIdleNotReachedAndReached()
94 spy(new TestMaxConnectionIdleManager(123L, ticker)); in shutdownThenMaxIdleReached()
/external/javapoet/src/test/java/com/squareup/javapoet/
DClassNameTest.java134 TypeElement spy = Mockito.spy(object); in preventGetKind() local
135 when(spy.getKind()).thenThrow(new AssertionError()); in preventGetKind()
136 when(spy.getEnclosingElement()).thenAnswer(invocation -> { in preventGetKind()
142 return spy; in preventGetKind()
/external/mockito/subprojects/inline/src/test/java/org/mockitoinline/
DRecursionTest.java12 import static org.mockito.Mockito.spy;
18 ConcurrentMap<String, String> map = spy(new ConcurrentHashMap<String, String>()); in testMockConcurrentHashMap()
DSuperCallTest.java10 import static org.mockito.Mockito.spy;
17 Dummy d = spy(new Dummy()); in testSuperMethodCall()
/external/apache-commons-math/src/main/java/org/apache/commons/math/dfp/
DDfpMath.java347 Dfp[] spy = new Dfp[2]; in log() local
348 spy[0] = pow(a.getTwo(), p2); // use spy[0] temporarily as a divisor in log()
349 spx[0] = spx[0].divide(spy[0]); in log()
350 spx[1] = spx[1].divide(spy[0]); in log()
352 spy[0] = a.newInstance("1.33333"); // Use spy[0] for comparison in log()
353 while (spx[0].add(spx[1]).greaterThan(spy[0])) { in log()
364 spy = splitMult(a.getField().getLn2Split(), spx); in log()
366 spz[0] = spz[0].add(spy[0]); in log()
367 spz[1] = spz[1].add(spy[1]); in log()
371 spy = splitMult(a.getField().getLn5Split(), spx); in log()
[all …]
/external/mockito/subprojects/inline/src/test/java/org/mockitoinline/bugs/
DSelfSpyReferenceMemoryLeakTest.java11 import static org.mockito.Mockito.spy;
19 final DeepRefSelfClass instance = spy(new DeepRefSelfClass()); in no_memory_leak_when_spy_holds_reference_to_self()
/external/bcc/src/lua/bpf/spec/
Ddecoder_spec.lua13 spy.on(jutil, 'funcbc')
21 assert.spy(jutil.funcbc).was.called()
/external/opencensus-java/exporters/stats/signalfx/src/test/java/io/opencensus/exporter/stats/signalfx/
DSignalFxStatsExporterWorkerThreadTest.java85 AggregateMetricSender spy = Mockito.spy(sender); in setUp()
86 Mockito.doReturn(session).when(spy).createSession(); in setUp()
87 return spy; in setUp()

123