Merge branch '2.1.x'

This commit is contained in:
Stephane Nicoll
2019-03-04 09:29:13 +01:00
11 changed files with 59 additions and 36 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,8 @@ import org.springframework.boot.test.web.client.MockServerRestTemplateCustomizer
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* Tests for {@link AutoConfigureMockRestServiceServer} with {@code enabled=false}.
*
@@ -38,9 +40,11 @@ public class AutoConfigureMockRestServiceServerEnabledFalseIntegrationTests {
@Autowired
private ApplicationContext applicationContext;
@Test(expected = NoSuchBeanDefinitionException.class)
@Test
public void mockServerRestTemplateCustomizerShouldNotBeRegistered() {
this.applicationContext.getBean(MockServerRestTemplateCustomizer.class);
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
.isThrownBy(() -> this.applicationContext
.getBean(MockServerRestTemplateCustomizer.class));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.client.MockRestServiceServer;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
@@ -49,9 +50,10 @@ public class RestClientTestNoComponentIntegrationTests {
@Autowired
private MockRestServiceServer server;
@Test(expected = NoSuchBeanDefinitionException.class)
@Test
public void exampleRestClientIsNotInjected() {
this.applicationContext.getBean(ExampleRestClient.class);
assertThatExceptionOfType(NoSuchBeanDefinitionException.class).isThrownBy(
() -> this.applicationContext.getBean(ExampleRestClient.class));
}
@Test