Merge branch '1.4.x' into 1.5.x
This commit is contained in:
@@ -26,6 +26,7 @@ import org.mockito.listeners.MethodInvocationReport;
|
||||
import org.mockito.mock.MockCreationSettings;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Reset strategy used on a mock bean. Usually applied to a mock via the
|
||||
@@ -53,8 +54,6 @@ public enum MockReset {
|
||||
*/
|
||||
NONE;
|
||||
|
||||
private static final MockUtil util = new MockUtil();
|
||||
|
||||
/**
|
||||
* Create {@link MockSettings settings} to be used with mocks where reset should occur
|
||||
* before each test method runs.
|
||||
@@ -105,12 +104,15 @@ public enum MockReset {
|
||||
@SuppressWarnings("rawtypes")
|
||||
static MockReset get(Object mock) {
|
||||
MockReset reset = MockReset.NONE;
|
||||
if (util.isMock(mock)) {
|
||||
MockCreationSettings settings = util.getMockSettings(mock);
|
||||
List listeners = settings.getInvocationListeners();
|
||||
for (Object listener : listeners) {
|
||||
if (listener instanceof ResetInvocationListener) {
|
||||
reset = ((ResetInvocationListener) listener).getReset();
|
||||
if (ClassUtils.isPresent("org.mockito.internal.util.MockUtil", null)) {
|
||||
MockUtil mockUtil = new MockUtil();
|
||||
if (mockUtil.isMock(mock)) {
|
||||
MockCreationSettings settings = mockUtil.getMockSettings(mock);
|
||||
List listeners = settings.getInvocationListeners();
|
||||
for (Object listener : listeners) {
|
||||
if (listener instanceof ResetInvocationListener) {
|
||||
reset = ((ResetInvocationListener) listener).getReset();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ package org.springframework.boot.test.context.bootstrap;
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
|
||||
/**
|
||||
* Example configuration used in {@link SpringBootTestContextBootstrapperIntegrationTests}.
|
||||
* Example configuration used in
|
||||
* {@link SpringBootTestContextBootstrapperIntegrationTests}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user