org.mockito.MockingDetails Java Examples
The following examples show how to use
org.mockito.MockingDetails.
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 File: MockStatic.java From dexmaker with Apache License 2.0 | 6 votes |
@Test public void verifyMockingDetails() throws Exception { MockitoSession session = mockitoSession().mockStatic(SuperClass.class) .spyStatic(SubClass.class).startMocking(); try { when(SuperClass.returnB()).thenReturn("fakeB"); SuperClass.returnB(); SuperClass.returnC(); MockingDetails superClassDetails = mockingDetails(staticMockMarker(SuperClass.class)); assertTrue(superClassDetails.isMock()); assertFalse(superClassDetails.isSpy()); assertEquals(2, superClassDetails.getInvocations().size()); assertEquals(1, superClassDetails.getStubbings().size()); MockingDetails subClassDetails = mockingDetails(staticMockMarker(SubClass.class)); assertTrue(subClassDetails.isMock()); assertTrue(subClassDetails.isSpy()); } finally { session.finishMocking(); } }
Example #2
Source File: OkHttpClientConfigurationTests.java From spring-cloud-openfeign with Apache License 2.0 | 5 votes |
@Test public void testHttpClientWithFeign() { Client delegate = this.feignClient.getDelegate(); assertThat(feign.okhttp.OkHttpClient.class.isInstance(delegate)).isTrue(); feign.okhttp.OkHttpClient okHttpClient = (feign.okhttp.OkHttpClient) delegate; OkHttpClient httpClient = getField(okHttpClient, "delegate"); MockingDetails httpClientDetails = mockingDetails(httpClient); assertThat(httpClientDetails.isMock()).isTrue(); }
Example #3
Source File: ApacheHttpClientConfigurationTests.java From spring-cloud-openfeign with Apache License 2.0 | 5 votes |
@Test public void testHttpClientWithFeign() { Client delegate = this.feignClient.getDelegate(); assertThat(ApacheHttpClient.class.isInstance(delegate)).isTrue(); ApacheHttpClient apacheHttpClient = (ApacheHttpClient) delegate; HttpClient httpClient = getField(apacheHttpClient, "client"); MockingDetails httpClientDetails = mockingDetails(httpClient); assertThat(httpClientDetails.isMock()).isTrue(); }
Example #4
Source File: WithMockito.java From mockito-java8 with Apache License 2.0 | 4 votes |
/** * Delegates call to {@link Mockito#mockingDetails(Object)}. */ default MockingDetails mockingDetails(Object toInspect) { return Mockito.mockingDetails(toInspect); }
Example #5
Source File: MockitoCore.java From astor with GNU General Public License v2.0 | 4 votes |
public MockingDetails mockingDetails(Object toInspect) { return new DefaultMockingDetails(toInspect, new MockUtil()); }