1
1
/*
2
- * Copyright 2002-2016 the original author or authors.
2
+ * Copyright 2002-2018 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.
19
19
import java .util .HashMap ;
20
20
import java .util .Map ;
21
21
22
- import org .junit .Before ;
23
22
import org .junit .Test ;
24
23
25
24
import org .springframework .beans .factory .support .DefaultListableBeanFactory ;
37
36
public class CustomScopeConfigurerTests {
38
37
39
38
private static final String FOO_SCOPE = "fooScope" ;
40
- private ConfigurableListableBeanFactory factory ;
41
39
42
- @ Before
43
- public void setUp () {
44
- factory = new DefaultListableBeanFactory ();
45
- }
40
+ private final ConfigurableListableBeanFactory factory = new DefaultListableBeanFactory ();
41
+
46
42
47
43
@ Test
48
- public void testWithNoScopes () throws Exception {
44
+ public void testWithNoScopes () {
49
45
CustomScopeConfigurer figurer = new CustomScopeConfigurer ();
50
46
figurer .postProcessBeanFactory (factory );
51
47
}
52
48
53
49
@ Test
54
- public void testSunnyDayWithBonaFideScopeInstance () throws Exception {
50
+ public void testSunnyDayWithBonaFideScopeInstance () {
55
51
Scope scope = mock (Scope .class );
56
52
factory .registerScope (FOO_SCOPE , scope );
57
53
Map <String , Object > scopes = new HashMap <>();
@@ -62,7 +58,7 @@ public void testSunnyDayWithBonaFideScopeInstance() throws Exception {
62
58
}
63
59
64
60
@ Test
65
- public void testSunnyDayWithBonaFideScopeClass () throws Exception {
61
+ public void testSunnyDayWithBonaFideScopeClass () {
66
62
Map <String , Object > scopes = new HashMap <>();
67
63
scopes .put (FOO_SCOPE , NoOpScope .class );
68
64
CustomScopeConfigurer figurer = new CustomScopeConfigurer ();
@@ -72,7 +68,7 @@ public void testSunnyDayWithBonaFideScopeClass() throws Exception {
72
68
}
73
69
74
70
@ Test
75
- public void testSunnyDayWithBonaFideScopeClassname () throws Exception {
71
+ public void testSunnyDayWithBonaFideScopeClassName () {
76
72
Map <String , Object > scopes = new HashMap <>();
77
73
scopes .put (FOO_SCOPE , NoOpScope .class .getName ());
78
74
CustomScopeConfigurer figurer = new CustomScopeConfigurer ();
@@ -82,7 +78,7 @@ public void testSunnyDayWithBonaFideScopeClassname() throws Exception {
82
78
}
83
79
84
80
@ Test (expected = IllegalArgumentException .class )
85
- public void testWhereScopeMapHasNullScopeValueInEntrySet () throws Exception {
81
+ public void testWhereScopeMapHasNullScopeValueInEntrySet () {
86
82
Map <String , Object > scopes = new HashMap <>();
87
83
scopes .put (FOO_SCOPE , null );
88
84
CustomScopeConfigurer figurer = new CustomScopeConfigurer ();
@@ -91,19 +87,19 @@ public void testWhereScopeMapHasNullScopeValueInEntrySet() throws Exception {
91
87
}
92
88
93
89
@ Test (expected = IllegalArgumentException .class )
94
- public void testWhereScopeMapHasNonScopeInstanceInEntrySet () throws Exception {
90
+ public void testWhereScopeMapHasNonScopeInstanceInEntrySet () {
95
91
Map <String , Object > scopes = new HashMap <>();
96
- scopes .put (FOO_SCOPE , this ); // <-- not a valid value...
92
+ scopes .put (FOO_SCOPE , this ); // <-- not a valid value...
97
93
CustomScopeConfigurer figurer = new CustomScopeConfigurer ();
98
94
figurer .setScopes (scopes );
99
95
figurer .postProcessBeanFactory (factory );
100
96
}
101
97
102
98
@ SuppressWarnings ("unchecked" )
103
99
@ Test (expected = ClassCastException .class )
104
- public void testWhereScopeMapHasNonStringTypedScopeNameInKeySet () throws Exception {
100
+ public void testWhereScopeMapHasNonStringTypedScopeNameInKeySet () {
105
101
Map scopes = new HashMap ();
106
- scopes .put (this , new NoOpScope ()); // <-- not a valid value (the key)...
102
+ scopes .put (this , new NoOpScope ()); // <-- not a valid value (the key)...
107
103
CustomScopeConfigurer figurer = new CustomScopeConfigurer ();
108
104
figurer .setScopes (scopes );
109
105
figurer .postProcessBeanFactory (factory );
0 commit comments