@@ -62,7 +62,8 @@ public class JCacheErrorHandlerTests {
62
62
63
63
@ Before
64
64
public void setup () {
65
- AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext (Config .class );
65
+ AnnotationConfigApplicationContext context =
66
+ new AnnotationConfigApplicationContext (Config .class );
66
67
this .cache = context .getBean ("mockCache" , Cache .class );
67
68
this .errorCache = context .getBean ("mockErrorCache" , Cache .class );
68
69
this .errorHandler = context .getBean (CacheErrorHandler .class );
@@ -71,17 +72,19 @@ public void setup() {
71
72
72
73
@ Test
73
74
public void getFail () {
74
- UnsupportedOperationException exception = new UnsupportedOperationException ("Test exception on get" );
75
+ UnsupportedOperationException exception =
76
+ new UnsupportedOperationException ("Test exception on get" );
75
77
Object key = SimpleKeyGenerator .generateKey (0L );
76
- willThrow (exception ).given (cache ).get (key );
78
+ willThrow (exception ).given (this . cache ).get (key );
77
79
78
80
this .simpleService .get (0L );
79
- verify (errorHandler ).handleCacheGetError (exception , cache , key );
81
+ verify (this . errorHandler ).handleCacheGetError (exception , this . cache , key );
80
82
}
81
83
82
84
@ Test
83
85
public void getPutNewElementFail () {
84
- UnsupportedOperationException exception = new UnsupportedOperationException ("Test exception on put" );
86
+ UnsupportedOperationException exception =
87
+ new UnsupportedOperationException ("Test exception on put" );
85
88
Object key = SimpleKeyGenerator .generateKey (0L );
86
89
given (this .cache .get (key )).willReturn (null );
87
90
willThrow (exception ).given (this .cache ).put (key , 0L );
@@ -92,7 +95,8 @@ public void getPutNewElementFail() {
92
95
93
96
@ Test
94
97
public void getFailPutExceptionFail () {
95
- UnsupportedOperationException exceptionOnPut = new UnsupportedOperationException ("Test exception on put" );
98
+ UnsupportedOperationException exceptionOnPut =
99
+ new UnsupportedOperationException ("Test exception on put" );
96
100
Object key = SimpleKeyGenerator .generateKey (0L );
97
101
given (this .cache .get (key )).willReturn (null );
98
102
willThrow (exceptionOnPut ).given (this .errorCache ).put (key ,
@@ -110,31 +114,34 @@ public void getFailPutExceptionFail() {
110
114
111
115
@ Test
112
116
public void putFail () {
113
- UnsupportedOperationException exception = new UnsupportedOperationException ("Test exception on put" );
117
+ UnsupportedOperationException exception =
118
+ new UnsupportedOperationException ("Test exception on put" );
114
119
Object key = SimpleKeyGenerator .generateKey (0L );
115
- willThrow (exception ).given (cache ).put (key , 234L );
120
+ willThrow (exception ).given (this . cache ).put (key , 234L );
116
121
117
122
this .simpleService .put (0L , 234L );
118
- verify (errorHandler ).handleCachePutError (exception , cache , key , 234L );
123
+ verify (this . errorHandler ).handleCachePutError (exception , this . cache , key , 234L );
119
124
}
120
125
121
126
@ Test
122
127
public void evictFail () {
123
- UnsupportedOperationException exception = new UnsupportedOperationException ("Test exception on evict" );
128
+ UnsupportedOperationException exception =
129
+ new UnsupportedOperationException ("Test exception on evict" );
124
130
Object key = SimpleKeyGenerator .generateKey (0L );
125
- willThrow (exception ).given (cache ).evict (key );
131
+ willThrow (exception ).given (this . cache ).evict (key );
126
132
127
133
this .simpleService .evict (0L );
128
- verify (errorHandler ).handleCacheEvictError (exception , cache , key );
134
+ verify (this . errorHandler ).handleCacheEvictError (exception , this . cache , key );
129
135
}
130
136
131
137
@ Test
132
138
public void clearFail () {
133
- UnsupportedOperationException exception = new UnsupportedOperationException ("Test exception on evict" );
134
- willThrow (exception ).given (cache ).clear ();
139
+ UnsupportedOperationException exception =
140
+ new UnsupportedOperationException ("Test exception on evict" );
141
+ willThrow (exception ).given (this .cache ).clear ();
135
142
136
143
this .simpleService .clear ();
137
- verify (errorHandler ).handleCacheClearError (exception , cache );
144
+ verify (this . errorHandler ).handleCacheClearError (exception , this . cache );
138
145
}
139
146
140
147
@@ -187,7 +194,7 @@ public static class SimpleService {
187
194
188
195
@ CacheResult
189
196
public Object get (long id ) {
190
- return counter .getAndIncrement ();
197
+ return this . counter .getAndIncrement ();
191
198
}
192
199
193
200
@ CacheResult (exceptionCacheName = "error" )
0 commit comments