Home
last modified time | relevance | path

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

12

/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()
45 spy(new Object()); in shouldBeAbleToMockObjectBecauseWhyNot()
50 spy.add("one"); in shouldStub()
51 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()
DSpyingOnInterfacesTest.java25 import static org.mockito.Mockito.spy;
103 Object object = spy(impl.newInstance()); in shouldAllowSpyingOnDefaultMethod()
/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/guava/guava-tests/test/com/google/common/io/
DAppendableWriterTest.java88 SpyAppendable spy = new SpyAppendable(); in testCloseFlush() local
89 Writer writer = new AppendableWriter(spy); in testCloseFlush()
92 assertFalse(spy.flushed); in testCloseFlush()
93 assertFalse(spy.closed); in testCloseFlush()
96 assertTrue(spy.flushed); in testCloseFlush()
97 assertFalse(spy.closed); in testCloseFlush()
100 assertTrue(spy.flushed); in testCloseFlush()
101 assertTrue(spy.closed); in testCloseFlush()
/external/dexmaker/dexmaker-mockito-tests/src/androidTest/java/com/android/dx/mockito/tests/
DGeneralMocking.java40 import static org.mockito.Mockito.spy;
101 TestClass t = spy(originalT); in spyClass()
114 TestClass t = spy(TestClass.class); in spyNewClass()
144 TestClass t = spy(TestClass.class); in spyThrowingMethod()
158 TestClass t = spy(TestClass.class); in spyErrorMethod()
170 TestClass t = spy(TestClass.class); in spyExceptingMethod()
225 TestClass t = spy(TestClass.class); in callClassWithoutMatcher()
235 TestClass t = spy(TestClass.class); in callClassWithMatcher()
245 TestClass t = spy(TestClass.class); in callClassWithNullMatcher()
255 TestSubClass t = spy(TestSubClass.class); in callSubClassWithoutMatcher()
[all …]
DBlacklistedApis.java24 import static org.mockito.Mockito.spy;
62 FrameLayout parent = spy(new FrameLayout(targetContext)); in callBlacklistedPublicMethodRealMethod()
92 FrameLayout parent = spy(new FrameLayout(targetContext)); in copyBlacklistedFields()
111 spy(new View(InstrumentationRegistry.getTargetContext(), null)); in cannotCallBlackListedAfterSpying()
137 CallBlackListedMethod t = spy(new CallBlackListedMethod()); in spiesCannotBeUsedToCallHiddenMethods()
/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/util/concurrent/
DJdkFutureAdaptersTest.java59 ExecutorSpy spy = new ExecutorSpy(directExecutor()); in testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone() local
61 listenInPoolThread(abstractFuture, spy); in testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone()
66 assertFalse(spy.wasExecuted); in testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone()
77 assertFalse(spy.wasExecuted); in testListenInPoolThreadIgnoresExecutorWhenDelegateIsDone()
87 ExecutorSpy spy = new ExecutorSpy(executorService); in testListenInPoolThreadUsesGivenExecutor() local
89 listenInPoolThread(abstractFuture, spy); in testListenInPoolThreadUsesGivenExecutor()
94 assertFalse(spy.wasExecuted); in testListenInPoolThreadUsesGivenExecutor()
103 assertTrue(spy.wasExecuted); in testListenInPoolThreadUsesGivenExecutor()
/external/dexmaker/dexmaker-mockito-inline-tests/src/androidTest/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()
288 ClassWithPackagePrivateMethod c = spy(ClassWithPackagePrivateMethod.class); in spyClassWithPackagePrivateMethod()
298 ClassWithPackagePrivateMethod c = spy(original); in spyWrappedClassWithPackagePrivateMethod()
357 SubOfAbstractClassWithPackagePrivateMethod c = spy in spySubOfAbstractClassWithPackagePrivateMethod()
375 SubOfAbstractClassWithPackagePrivateMethod c = spy(original); in spyWrappedSubOfAbstractClassWithPackagePrivateMethod()
DMockFinal.java33 import static org.mockito.Mockito.spy;
180 SubClass spied = spy(SubClass.class); in spySubClass()
181 SuperClass spiedSuper = spy(SuperClass.class); in spySubClass()
/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/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()
256 spy(IMethods.class); in mocking_interfaces_with_constructor()
280 AbstractThing thing = spy(AbstractThing.class); in abstract_method_returns_default()
286 AbstractThing thing = spy(AbstractThing.class); in abstract_method_stubbed()
293 List<?> list = spy(List.class); in interface_method_stubbed()
306 SomeConcreteClass<Integer> testBug = spy(new SomeConcreteClass<Integer>()); in handles_bridge_methods_correctly()
/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/
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/mockito/src/test/java/org/mockito/internal/util/
DDefaultMockingDetailsTest.java27 import static org.mockito.Mockito.spy;
53 assertTrue(mockingDetails(spy( new Gork())).isMock()); in should_know_spy()
54 assertTrue(mockingDetails(spy(Gork.class)).isMock()); in should_know_spy()
DMockUtilTest.java59 assertTrue(MockUtil.isSpy(Mockito.spy(new ArrayList()))); in should_validate_spy()
60 assertTrue(MockUtil.isSpy(Mockito.spy(ArrayList.class))); in should_validate_spy()
/external/robolectric-shadows/robolectric/src/test/java/org/robolectric/shadows/
DShadowConnectivityManagerTest.java8 import static org.mockito.Mockito.spy;
340 spy(createSimpleOnNetworkActiveListener()); in addDefaultNetworkActiveListener_shouldAddListener()
342 spy(createSimpleOnNetworkActiveListener()); in addDefaultNetworkActiveListener_shouldAddListener()
357 spy(createSimpleOnNetworkActiveListener()); in removeDefaultNetworkActiveListener_shouldRemoveListeners()
359 spy(createSimpleOnNetworkActiveListener()); in removeDefaultNetworkActiveListener_shouldRemoveListeners()
/external/mockito/src/test/java/org/mockito/
DInvocationFactoryTest.java17 import static org.mockito.Mockito.spy;
27 final TestClass mock = spy(TestClass.class);
/external/robolectric-shadows/shadows/supportv4/src/test/java/org/robolectric/shadows/support/v4/
DSupportFragmentControllerTest.java4 import static org.mockito.Mockito.spy;
101 final LoginFragment fragment = spy(new LoginFragment()); in isPaused()
115 final LoginFragment fragment = spy(new LoginFragment()); in isStopped()
/external/robolectric-shadows/robolectric/src/test/java/org/robolectric/android/controller/
DFragmentControllerTest.java4 import static org.mockito.Mockito.spy;
96 final LoginFragment fragment = spy(new LoginFragment()); in isPaused()
110 final LoginFragment fragment = spy(new LoginFragment()); in isStopped()
/external/volley/src/test/java/com/android/volley/toolbox/
DDiskBasedCacheTest.java61 import static org.mockito.Mockito.spy;
285 OutputStream mockedOutputStream = spy(OutputStream.class); in testFileIsDeletedWhenWriteHeaderFails()
289 DiskBasedCache readonly = spy((DiskBasedCache) cache); in testFileIsDeletedWhenWriteHeaderFails()
312 InputStream mockedInputStream = spy(InputStream.class); in testIOExceptionInInitialize()
318 spy(new DiskBasedCache(temporaryFolder.getRoot())); in testIOExceptionInInitialize()

12