Skip to content

Commit 85b20aa

Browse files
committed
Polish
1 parent 908261b commit 85b20aa

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/JCacheErrorHandlerTests.java

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public class JCacheErrorHandlerTests {
6262

6363
@Before
6464
public void setup() {
65-
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
65+
AnnotationConfigApplicationContext context =
66+
new AnnotationConfigApplicationContext(Config.class);
6667
this.cache = context.getBean("mockCache", Cache.class);
6768
this.errorCache = context.getBean("mockErrorCache", Cache.class);
6869
this.errorHandler = context.getBean(CacheErrorHandler.class);
@@ -71,17 +72,19 @@ public void setup() {
7172

7273
@Test
7374
public void getFail() {
74-
UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on get");
75+
UnsupportedOperationException exception =
76+
new UnsupportedOperationException("Test exception on get");
7577
Object key = SimpleKeyGenerator.generateKey(0L);
76-
willThrow(exception).given(cache).get(key);
78+
willThrow(exception).given(this.cache).get(key);
7779

7880
this.simpleService.get(0L);
79-
verify(errorHandler).handleCacheGetError(exception, cache, key);
81+
verify(this.errorHandler).handleCacheGetError(exception, this.cache, key);
8082
}
8183

8284
@Test
8385
public void getPutNewElementFail() {
84-
UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on put");
86+
UnsupportedOperationException exception =
87+
new UnsupportedOperationException("Test exception on put");
8588
Object key = SimpleKeyGenerator.generateKey(0L);
8689
given(this.cache.get(key)).willReturn(null);
8790
willThrow(exception).given(this.cache).put(key, 0L);
@@ -92,7 +95,8 @@ public void getPutNewElementFail() {
9295

9396
@Test
9497
public void getFailPutExceptionFail() {
95-
UnsupportedOperationException exceptionOnPut = new UnsupportedOperationException("Test exception on put");
98+
UnsupportedOperationException exceptionOnPut =
99+
new UnsupportedOperationException("Test exception on put");
96100
Object key = SimpleKeyGenerator.generateKey(0L);
97101
given(this.cache.get(key)).willReturn(null);
98102
willThrow(exceptionOnPut).given(this.errorCache).put(key,
@@ -110,31 +114,34 @@ public void getFailPutExceptionFail() {
110114

111115
@Test
112116
public void putFail() {
113-
UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on put");
117+
UnsupportedOperationException exception =
118+
new UnsupportedOperationException("Test exception on put");
114119
Object key = SimpleKeyGenerator.generateKey(0L);
115-
willThrow(exception).given(cache).put(key, 234L);
120+
willThrow(exception).given(this.cache).put(key, 234L);
116121

117122
this.simpleService.put(0L, 234L);
118-
verify(errorHandler).handleCachePutError(exception, cache, key, 234L);
123+
verify(this.errorHandler).handleCachePutError(exception, this.cache, key, 234L);
119124
}
120125

121126
@Test
122127
public void evictFail() {
123-
UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on evict");
128+
UnsupportedOperationException exception =
129+
new UnsupportedOperationException("Test exception on evict");
124130
Object key = SimpleKeyGenerator.generateKey(0L);
125-
willThrow(exception).given(cache).evict(key);
131+
willThrow(exception).given(this.cache).evict(key);
126132

127133
this.simpleService.evict(0L);
128-
verify(errorHandler).handleCacheEvictError(exception, cache, key);
134+
verify(this.errorHandler).handleCacheEvictError(exception, this.cache, key);
129135
}
130136

131137
@Test
132138
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();
135142

136143
this.simpleService.clear();
137-
verify(errorHandler).handleCacheClearError(exception, cache);
144+
verify(this.errorHandler).handleCacheClearError(exception, this.cache);
138145
}
139146

140147

@@ -187,7 +194,7 @@ public static class SimpleService {
187194

188195
@CacheResult
189196
public Object get(long id) {
190-
return counter.getAndIncrement();
197+
return this.counter.getAndIncrement();
191198
}
192199

193200
@CacheResult(exceptionCacheName = "error")

0 commit comments

Comments
 (0)