1
1
/*
2
- * Copyright 2002-2019 the original author or authors.
2
+ * Copyright 2002-2022 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
28
28
* @author Jeff Brown
29
29
* @author Juergen Hoeller
30
30
*/
31
- public class GroovyApplicationContextTests {
31
+ class GroovyApplicationContextTests {
32
32
33
33
@ Test
34
- public void testLoadingConfigFile () {
34
+ void loadingConfigFile () {
35
35
GenericGroovyApplicationContext ctx = new GenericGroovyApplicationContext (
36
36
"org/springframework/context/groovy/applicationContext.groovy" );
37
37
38
38
Object framework = ctx .getBean ("framework" );
39
39
assertThat (framework ).as ("could not find framework bean" ).isNotNull ();
40
40
assertThat (framework ).isEqualTo ("Grails" );
41
+
42
+ ctx .close ();
41
43
}
42
44
43
45
@ Test
44
- public void testLoadingMultipleConfigFiles () {
46
+ void loadingMultipleConfigFiles () {
45
47
GenericGroovyApplicationContext ctx = new GenericGroovyApplicationContext (
46
48
"org/springframework/context/groovy/applicationContext2.groovy" ,
47
49
"org/springframework/context/groovy/applicationContext.groovy" );
@@ -53,10 +55,12 @@ public void testLoadingMultipleConfigFiles() {
53
55
Object company = ctx .getBean ("company" );
54
56
assertThat (company ).as ("could not find company bean" ).isNotNull ();
55
57
assertThat (company ).isEqualTo ("SpringSource" );
58
+
59
+ ctx .close ();
56
60
}
57
61
58
62
@ Test
59
- public void testLoadingMultipleConfigFilesWithRelativeClass () {
63
+ void loadingMultipleConfigFilesWithRelativeClass () {
60
64
GenericGroovyApplicationContext ctx = new GenericGroovyApplicationContext ();
61
65
ctx .load (GroovyApplicationContextTests .class , "applicationContext2.groovy" , "applicationContext.groovy" );
62
66
ctx .refresh ();
@@ -68,10 +72,12 @@ public void testLoadingMultipleConfigFilesWithRelativeClass() {
68
72
Object company = ctx .getBean ("company" );
69
73
assertThat (company ).as ("could not find company bean" ).isNotNull ();
70
74
assertThat (company ).isEqualTo ("SpringSource" );
75
+
76
+ ctx .close ();
71
77
}
72
78
73
79
@ Test
74
- public void testConfigFileParsingError () {
80
+ void configFileParsingError () {
75
81
assertThatExceptionOfType (BeanDefinitionParsingException .class ).isThrownBy (() ->
76
82
new GenericGroovyApplicationContext ("org/springframework/context/groovy/applicationContext-error.groovy" ));
77
83
}
0 commit comments