Skip to content

Commit 579c6fe

Browse files
committed
Polish
1 parent eacb6b1 commit 579c6fe

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public abstract class AbstractApplicationContextRunnerTests<T extends AbstractAp
5454
public void runWithSystemPropertiesShouldSetAndRemoveProperties() {
5555
String key = "test." + UUID.randomUUID().toString();
5656
assertThat(System.getProperties().containsKey(key)).isFalse();
57-
get().withSystemProperties(key + "=value").run((loaded) -> {
57+
get().withSystemProperties(key + "=value").run((context) -> {
5858
assertThat(System.getProperties()).containsEntry(key, "value");
5959
});
6060
assertThat(System.getProperties().containsKey(key)).isFalse();
@@ -66,8 +66,8 @@ public void runWithSystemPropertiesWhenContextFailsShouldRemoveProperties()
6666
String key = "test." + UUID.randomUUID().toString();
6767
assertThat(System.getProperties().containsKey(key)).isFalse();
6868
get().withSystemProperties(key + "=value")
69-
.withUserConfiguration(FailingConfig.class).run((loaded) -> {
70-
assertThat(loaded).hasFailed();
69+
.withUserConfiguration(FailingConfig.class).run((context) -> {
70+
assertThat(context).hasFailed();
7171
});
7272
assertThat(System.getProperties().containsKey(key)).isFalse();
7373
}
@@ -79,7 +79,7 @@ public void runWithSystemPropertiesShouldRestoreOriginalProperties()
7979
System.setProperty(key, "value");
8080
try {
8181
assertThat(System.getProperties().getProperty(key)).isEqualTo("value");
82-
get().withSystemProperties(key + "=newValue").run((loaded) -> {
82+
get().withSystemProperties(key + "=newValue").run((context) -> {
8383
assertThat(System.getProperties()).containsEntry(key, "newValue");
8484
});
8585
assertThat(System.getProperties().getProperty(key)).isEqualTo("value");
@@ -96,7 +96,7 @@ public void runWithSystemPropertiesWhenValueIsNullShouldRemoveProperty()
9696
System.setProperty(key, "value");
9797
try {
9898
assertThat(System.getProperties().getProperty(key)).isEqualTo("value");
99-
get().withSystemProperties(key + "=").run((loaded) -> {
99+
get().withSystemProperties(key + "=").run((context) -> {
100100
assertThat(System.getProperties()).doesNotContainKey(key);
101101
});
102102
assertThat(System.getProperties().getProperty(key)).isEqualTo("value");
@@ -109,8 +109,8 @@ public void runWithSystemPropertiesWhenValueIsNullShouldRemoveProperty()
109109
@Test
110110
public void runWithMultiplePropertyValuesShouldAllAllValues() throws Exception {
111111
get().withPropertyValues("test.foo=1").withPropertyValues("test.bar=2")
112-
.run((loaded) -> {
113-
Environment environment = loaded.getEnvironment();
112+
.run((context) -> {
113+
Environment environment = context.getEnvironment();
114114
assertThat(environment.getProperty("test.foo")).isEqualTo("1");
115115
assertThat(environment.getProperty("test.bar")).isEqualTo("2");
116116
});
@@ -120,40 +120,40 @@ public void runWithMultiplePropertyValuesShouldAllAllValues() throws Exception {
120120
public void runWithPropertyValuesWhenHasExistingShouldReplaceValue()
121121
throws Exception {
122122
get().withPropertyValues("test.foo=1").withPropertyValues("test.foo=2")
123-
.run((loaded) -> {
124-
Environment environment = loaded.getEnvironment();
123+
.run((context) -> {
124+
Environment environment = context.getEnvironment();
125125
assertThat(environment.getProperty("test.foo")).isEqualTo("2");
126126
});
127127
}
128128

129129
@Test
130130
public void runWithConfigurationsShouldRegisterConfigurations() throws Exception {
131131
get().withUserConfiguration(FooConfig.class)
132-
.run((loaded) -> assertThat(loaded).hasBean("foo"));
132+
.run((context) -> assertThat(context).hasBean("foo"));
133133
}
134134

135135
@Test
136136
public void runWithMultipleConfigurationsShouldRegisterAllConfigurations()
137137
throws Exception {
138138
get().withUserConfiguration(FooConfig.class)
139139
.withConfiguration(UserConfigurations.of(BarConfig.class))
140-
.run((loaded) -> assertThat(loaded).hasBean("foo").hasBean("bar"));
140+
.run((context) -> assertThat(context).hasBean("foo").hasBean("bar"));
141141
}
142142

143143
@Test
144144
public void runWithFailedContextShouldReturnFailedAssertableContext()
145145
throws Exception {
146146
get().withUserConfiguration(FailingConfig.class)
147-
.run((loaded) -> assertThat(loaded).hasFailed());
147+
.run((context) -> assertThat(context).hasFailed());
148148
}
149149

150150
@Test
151151
public void runWithClassLoaderShouldSetClassLoader() throws Exception {
152152
get().withClassLoader(
153153
new HidePackagesClassLoader(Gson.class.getPackage().getName()))
154-
.run((loaded) -> {
154+
.run((context) -> {
155155
try {
156-
ClassUtils.forName(Gson.class.getName(), loaded.getClassLoader());
156+
ClassUtils.forName(Gson.class.getName(), context.getClassLoader());
157157
fail("Should have thrown a ClassNotFoundException");
158158
}
159159
catch (ClassNotFoundException e) {

spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/WebApplicationContextRunnerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class WebApplicationContextRunnerTests extends
3535

3636
@Test
3737
public void contextShouldHaveMockServletContext() throws Exception {
38-
get().run((loaded) -> assertThat(loaded.getServletContext())
38+
get().run((context) -> assertThat(context.getServletContext())
3939
.isInstanceOf(MockServletContext.class));
4040
}
4141

0 commit comments

Comments
 (0)