Skip to content

Commit 2a74d15

Browse files
committed
run format
Signed-off-by: yongjunhong <[email protected]>
1 parent 20a225c commit 2a74d15

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

module/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextFactory.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public ConfigurableApplicationContext createManagementContext(ApplicationContext
6565
.createEnvironment(this.webApplicationType);
6666
Assert.state(childEnvironment != null, "'childEnvironment' must not be null");
6767
if (parentEnvironment instanceof ConfigurableEnvironment configurableEnvironment) {
68-
configurableEnvironment.getPropertySources().forEach(propertySource -> {
68+
configurableEnvironment.getPropertySources().forEach((propertySource) -> {
6969
if (isManagementPropertySource(propertySource, childEnvironment)) {
7070
childEnvironment.getPropertySources().addLast(propertySource);
7171
}
@@ -79,7 +79,8 @@ public ConfigurableApplicationContext createManagementContext(ApplicationContext
7979
return managementContext;
8080
}
8181

82-
private boolean isManagementPropertySource(PropertySource<?> propertySource, ConfigurableEnvironment childEnvironment) {
82+
private boolean isManagementPropertySource(PropertySource<?> propertySource,
83+
ConfigurableEnvironment childEnvironment) {
8384
return propertySource.getName().contains("management")
8485
&& !childEnvironment.getPropertySources().contains(propertySource.getName());
8586
}
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525
import org.springframework.core.env.PropertySource;
2626

2727
import static org.assertj.core.api.Assertions.assertThat;
28+
import static org.mockito.BDDMockito.given;
2829
import static org.mockito.Mockito.mock;
29-
import static org.mockito.Mockito.when;
3030

3131
/**
32-
* Test for {@link ManagementContextFactory}.
32+
* Tests for {@link ManagementContextFactory}.
3333
*
3434
* author Yongjun Hong
3535
*/
36-
class ManagementContextFactoryTest {
36+
class ManagementContextFactoryTests {
3737

3838
@Test
3939
void createManagementContextCopiesManagementPropertySources() {
@@ -47,8 +47,8 @@ public Object getProperty(String name) {
4747
}
4848
};
4949
parentPropertySources.addLast(managementPropertySource);
50-
when(parentEnvironment.getPropertySources()).thenReturn(parentPropertySources);
51-
when(parentContext.getEnvironment()).thenReturn(parentEnvironment);
50+
given(parentEnvironment.getPropertySources()).willReturn(parentPropertySources);
51+
given(parentContext.getEnvironment()).willReturn(parentEnvironment);
5252

5353
ManagementContextFactory factory = new ManagementContextFactory(WebApplicationType.SERVLET, null);
5454

@@ -57,4 +57,5 @@ public Object getProperty(String name) {
5757
ConfigurableEnvironment childEnvironment = managementContext.getEnvironment();
5858
assertThat(childEnvironment.getPropertySources().contains("managementProperty")).isTrue();
5959
}
60+
6061
}

0 commit comments

Comments
 (0)