Skip to content

Commit e94e67c

Browse files
committed
Polish GroovyApplicationContextTests
See gh-27945
1 parent 1cf2960 commit e94e67c

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Diff for: spring-context/src/test/java/org/springframework/context/groovy/GroovyApplicationContextTests.java

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,20 +28,22 @@
2828
* @author Jeff Brown
2929
* @author Juergen Hoeller
3030
*/
31-
public class GroovyApplicationContextTests {
31+
class GroovyApplicationContextTests {
3232

3333
@Test
34-
public void testLoadingConfigFile() {
34+
void loadingConfigFile() {
3535
GenericGroovyApplicationContext ctx = new GenericGroovyApplicationContext(
3636
"org/springframework/context/groovy/applicationContext.groovy");
3737

3838
Object framework = ctx.getBean("framework");
3939
assertThat(framework).as("could not find framework bean").isNotNull();
4040
assertThat(framework).isEqualTo("Grails");
41+
42+
ctx.close();
4143
}
4244

4345
@Test
44-
public void testLoadingMultipleConfigFiles() {
46+
void loadingMultipleConfigFiles() {
4547
GenericGroovyApplicationContext ctx = new GenericGroovyApplicationContext(
4648
"org/springframework/context/groovy/applicationContext2.groovy",
4749
"org/springframework/context/groovy/applicationContext.groovy");
@@ -53,10 +55,12 @@ public void testLoadingMultipleConfigFiles() {
5355
Object company = ctx.getBean("company");
5456
assertThat(company).as("could not find company bean").isNotNull();
5557
assertThat(company).isEqualTo("SpringSource");
58+
59+
ctx.close();
5660
}
5761

5862
@Test
59-
public void testLoadingMultipleConfigFilesWithRelativeClass() {
63+
void loadingMultipleConfigFilesWithRelativeClass() {
6064
GenericGroovyApplicationContext ctx = new GenericGroovyApplicationContext();
6165
ctx.load(GroovyApplicationContextTests.class, "applicationContext2.groovy", "applicationContext.groovy");
6266
ctx.refresh();
@@ -68,10 +72,12 @@ public void testLoadingMultipleConfigFilesWithRelativeClass() {
6872
Object company = ctx.getBean("company");
6973
assertThat(company).as("could not find company bean").isNotNull();
7074
assertThat(company).isEqualTo("SpringSource");
75+
76+
ctx.close();
7177
}
7278

7379
@Test
74-
public void testConfigFileParsingError() {
80+
void configFileParsingError() {
7581
assertThatExceptionOfType(BeanDefinitionParsingException.class).isThrownBy(() ->
7682
new GenericGroovyApplicationContext("org/springframework/context/groovy/applicationContext-error.groovy"));
7783
}

0 commit comments

Comments
 (0)