pull/2430/merge
Phillip Webb 8 years ago
parent 6776ec2704
commit 0cc313f224

@ -27,8 +27,8 @@ import org.springframework.boot.actuate.metrics.Metric;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.verify;
/**

@ -35,9 +35,9 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.util.StreamUtils;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.argThat;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.mock;
/**

@ -41,9 +41,9 @@ import org.mockito.stubbing.Answer;
import org.springframework.boot.cli.testutil.SystemProperties;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
/**
* Tests for {@link SettingsXmlRepositorySystemSessionAutoConfiguration}.

@ -95,19 +95,17 @@ final class SpringBootMockUtil {
private static class Mockito1MockUtilAdapter implements MockUtilAdapter {
private final MockUtil mockUtil = BeanUtils.instantiate(MockUtil.class);
private final MockUtil mockUtil = BeanUtils.instantiateClass(MockUtil.class);
private final Method getMockSettingsMethod = ReflectionUtils
.findMethod(MockUtil.class, "getMockSettings", Object.class);
private static final MockingProgress mockingProgress =
createThreadSafeMockingProgress();
private static final MockingProgress mockingProgress = createThreadSafeMockingProgress();
private final Method reportMatcherMethod = ReflectionUtils.findMethod(
ArgumentMatcherStorage.class, "reportMatcher", Matcher.class);
private final Method reportMatcherMethod = ReflectionUtils
.findMethod(ArgumentMatcherStorage.class, "reportMatcher", Matcher.class);
private static final Constructor<MockAwareVerificationMode> mockAwareVerificationModeConstructor =
getMockAwareVerificationModeConstructor();
private static final Constructor<MockAwareVerificationMode> mockAwareVerificationModeConstructor = getMockAwareVerificationModeConstructor();
private static MockingProgress createThreadSafeMockingProgress() {
try {

@ -643,11 +643,11 @@ public class SpringApplicationTests {
}
catch (RuntimeException ex) {
}
ArgumentCaptor<RuntimeException> ac = ArgumentCaptor.forClass(
RuntimeException.class);
verify(handler).registerLoggedException(ac.capture());
RuntimeException exception = ac.getValue();
assertThat(exception).hasCauseInstanceOf(RefreshFailureException.class);
ArgumentCaptor<RuntimeException> exceptionCaptor = ArgumentCaptor
.forClass(RuntimeException.class);
verify(handler).registerLoggedException(exceptionCaptor.capture());
assertThat(exceptionCaptor.getValue())
.hasCauseInstanceOf(RefreshFailureException.class);
assertThat(this.output.toString()).doesNotContain("NullPointerException");
}

@ -38,8 +38,8 @@ import org.mockito.stubbing.Answer;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@ -132,8 +132,7 @@ public class MockEmbeddedServletContainerFactory
@Override
public Void answer(InvocationOnMock invocation)
throws Throwable {
initParameters.put(
invocation.getArgument(0),
initParameters.put(invocation.getArgument(0),
invocation.getArgument(1));
return null;
}
@ -146,8 +145,7 @@ public class MockEmbeddedServletContainerFactory
@Override
public String answer(InvocationOnMock invocation)
throws Throwable {
return initParameters
.get(invocation.getArgument(0));
return initParameters.get(invocation.getArgument(0));
}
});
given(this.servletContext.getAttributeNames()).willReturn(

@ -33,8 +33,8 @@ import org.springframework.web.util.UriTemplateHandler;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.verify;
/**
@ -61,8 +61,7 @@ public class RootUriTemplateHandlerTests {
this.uri = new URI("http://example.com/hello");
this.handler = new RootUriTemplateHandler("http://example.com", this.delegate);
given(this.delegate.expand(anyString(), any(Map.class))).willReturn(this.uri);
given(this.delegate.expand(anyString(), (Object[]) any()))
.willReturn(this.uri);
given(this.delegate.expand(anyString(), (Object[]) any())).willReturn(this.uri);
}
@Test

Loading…
Cancel
Save