1
1
/*
2
- * Copyright 2002-2013 the original author or authors.
2
+ * Copyright 2002-2014 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.
16
16
17
17
package org .springframework .context .groovy ;
18
18
19
- import junit .framework . TestCase ;
19
+ import org . junit .Test ;
20
20
21
+ import org .springframework .beans .factory .parsing .BeanDefinitionParsingException ;
21
22
import org .springframework .context .support .GenericGroovyApplicationContext ;
22
23
24
+ import static org .junit .Assert .*;
25
+
23
26
/**
24
27
* @author Jeff Brown
25
28
* @author Juergen Hoeller
26
29
*/
27
- public class GroovyApplicationContextTests extends TestCase {
30
+ public class GroovyApplicationContextTests {
28
31
32
+ @ Test
29
33
public void testLoadingConfigFile () {
30
34
GenericGroovyApplicationContext ctx = new GenericGroovyApplicationContext (
31
35
"org/springframework/context/groovy/applicationContext.groovy" );
@@ -35,6 +39,7 @@ public void testLoadingConfigFile() {
35
39
assertEquals ("Grails" , framework );
36
40
}
37
41
42
+ @ Test
38
43
public void testLoadingMultipleConfigFiles () {
39
44
GenericGroovyApplicationContext ctx = new GenericGroovyApplicationContext (
40
45
"org/springframework/context/groovy/applicationContext2.groovy" ,
@@ -49,6 +54,7 @@ public void testLoadingMultipleConfigFiles() {
49
54
assertEquals ("SpringSource" , company );
50
55
}
51
56
57
+ @ Test
52
58
public void testLoadingMultipleConfigFilesWithRelativeClass () {
53
59
GenericGroovyApplicationContext ctx = new GenericGroovyApplicationContext ();
54
60
ctx .load (GroovyApplicationContextTests .class , "applicationContext2.groovy" , "applicationContext.groovy" );
@@ -63,4 +69,14 @@ public void testLoadingMultipleConfigFilesWithRelativeClass() {
63
69
assertEquals ("SpringSource" , company );
64
70
}
65
71
72
+ @ Test (expected = BeanDefinitionParsingException .class )
73
+ public void testConfigFileParsingError () {
74
+ new GenericGroovyApplicationContext ("org/springframework/context/groovy/applicationContext-error.groovy" );
75
+ }
76
+
77
+ @ Test (expected = BeanDefinitionParsingException .class )
78
+ public void testConfigFileParsingErrorWhenNamedBeans () {
79
+ new GenericGroovyApplicationContext ("org/springframework/context/groovy/beans.groovy" );
80
+ }
81
+
66
82
}
0 commit comments