Skip to content

Commit 5010e2d

Browse files
authored
Polish (#5759)
1 parent be6f962 commit 5010e2d

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

micrometer-core/src/test/java/io/micrometer/core/aop/CountedAspectTest.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void countedWithSuccessfulMetrics() {
6060

6161
Counter counter = meterRegistry.get("metric.success")
6262
.tag("method", "succeedWithMetrics")
63-
.tag("class", getClass().getName() + "$CountedService")
63+
.tag("class", CountedService.class.getName())
6464
.tag("extra", "tag")
6565
.tag("result", "success")
6666
.counter();
@@ -89,7 +89,7 @@ void countedWithFailure() {
8989

9090
Counter counter = meterRegistry.get("metric.failing")
9191
.tag("method", "fail")
92-
.tag("class", getClass().getName() + "$CountedService")
92+
.tag("class", CountedService.class.getName())
9393
.tag("exception", "RuntimeException")
9494
.tag("result", "failure")
9595
.counter();
@@ -129,7 +129,7 @@ void countedWithSuccessfulMetricsWhenCompleted() {
129129

130130
assertThat(meterRegistry.find("metric.success")
131131
.tag("method", "succeedWithMetrics")
132-
.tag("class", getClass().getName() + "$AsyncCountedService")
132+
.tag("class", AsyncCountedService.class.getName())
133133
.tag("extra", "tag")
134134
.tag("exception", "none")
135135
.tag("result", "success")
@@ -140,7 +140,7 @@ void countedWithSuccessfulMetricsWhenCompleted() {
140140

141141
Counter counterAfterCompletion = meterRegistry.get("metric.success")
142142
.tag("method", "succeedWithMetrics")
143-
.tag("class", getClass().getName() + "$AsyncCountedService")
143+
.tag("class", AsyncCountedService.class.getName())
144144
.tag("extra", "tag")
145145
.tag("exception", "none")
146146
.tag("result", "success")
@@ -157,7 +157,7 @@ void countedWithFailureWhenCompleted() {
157157

158158
assertThat(meterRegistry.find("metric.failing")
159159
.tag("method", "fail")
160-
.tag("class", getClass().getName() + "$AsyncCountedService")
160+
.tag("class", AsyncCountedService.class.getName())
161161
.tag("exception", "RuntimeException")
162162
.tag("result", "failure")
163163
.counter()).isNull();
@@ -167,7 +167,7 @@ void countedWithFailureWhenCompleted() {
167167

168168
Counter counter = meterRegistry.get("metric.failing")
169169
.tag("method", "fail")
170-
.tag("class", getClass().getName() + "$AsyncCountedService")
170+
.tag("class", AsyncCountedService.class.getName())
171171
.tag("exception", "RuntimeException")
172172
.tag("result", "failure")
173173
.counter();
@@ -218,7 +218,7 @@ void countedWithSuccessfulMetricsWhenReturnsCompletionStageNull() {
218218

219219
assertThat(meterRegistry.get("metric.success")
220220
.tag("method", "successButNull")
221-
.tag("class", getClass().getName() + "$AsyncCountedService")
221+
.tag("class", AsyncCountedService.class.getName())
222222
.tag("extra", "tag")
223223
.tag("exception", "none")
224224
.tag("result", "success")

micrometer-core/src/test/java/io/micrometer/core/aop/TimedAspectTest.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void timeMethod() {
5555
service.call();
5656

5757
assertThat(registry.get("call")
58-
.tag("class", getClass().getName() + "$TimedService")
58+
.tag("class", TimedService.class.getName())
5959
.tag("method", "call")
6060
.tag("extra", "tag")
6161
.timer()
@@ -88,7 +88,7 @@ void timeMethodWithLongTaskTimer() {
8888
service.longCall();
8989

9090
assertThat(registry.get("longCall")
91-
.tag("class", getClass().getName() + "$TimedService")
91+
.tag("class", TimedService.class.getName())
9292
.tag("method", "longCall")
9393
.tag("extra", "tag")
9494
.longTaskTimers()).hasSize(1);
@@ -136,7 +136,7 @@ void timeMethodWithError() {
136136
assertThatThrownBy(service::callRaisingError).isInstanceOf(TestError.class);
137137

138138
assertThat(registry.get("callRaisingError")
139-
.tag("class", getClass().getName() + "$TimedService")
139+
.tag("class", TimedService.class.getName())
140140
.tag("method", "callRaisingError")
141141
.tag("extra", "tag")
142142
.tag("exception", "TestError")
@@ -158,7 +158,7 @@ void timeMethodWithErrorAndLongTaskTimer() {
158158
assertThatThrownBy(service::longCallRaisingError).isInstanceOf(TestError.class);
159159

160160
assertThat(registry.get("longCallRaisingError")
161-
.tag("class", getClass().getName() + "$TimedService")
161+
.tag("class", TimedService.class.getName())
162162
.tag("method", "longCallRaisingError")
163163
.tag("extra", "tag")
164164
.longTaskTimer()
@@ -183,7 +183,7 @@ void timeMethodWhenCompleted() {
183183
completableFuture.join();
184184

185185
assertThat(registry.get("call")
186-
.tag("class", getClass().getName() + "$AsyncTimedService")
186+
.tag("class", AsyncTimedService.class.getName())
187187
.tag("method", "call")
188188
.tag("extra", "tag")
189189
.tag("exception", "none")
@@ -209,7 +209,7 @@ void timeMethodWhenCompletedExceptionally() {
209209
assertThatThrownBy(completableFuture::join).isInstanceOf(CompletionException.class);
210210

211211
assertThat(registry.get("call")
212-
.tag("class", getClass().getName() + "$AsyncTimedService")
212+
.tag("class", AsyncTimedService.class.getName())
213213
.tag("method", "call")
214214
.tag("extra", "tag")
215215
.tag("exception", "IllegalStateException")
@@ -232,7 +232,7 @@ void timeMethodWhenReturnCompletionStageNull() {
232232
assertThat(registry.getMeters()).isNotEmpty();
233233

234234
assertThat(registry.get("callNull")
235-
.tag("class", getClass().getName() + "$AsyncTimedService")
235+
.tag("class", AsyncTimedService.class.getName())
236236
.tag("method", "callNull")
237237
.tag("extra", "tag")
238238
.tag("exception", "none")
@@ -253,7 +253,7 @@ void timeMethodWithLongTaskTimerWhenCompleted() {
253253
CompletableFuture<?> completableFuture = service.longCall(guardedResult);
254254

255255
assertThat(registry.find("longCall")
256-
.tag("class", getClass().getName() + "$AsyncTimedService")
256+
.tag("class", AsyncTimedService.class.getName())
257257
.tag("method", "longCall")
258258
.tag("extra", "tag")
259259
.longTaskTimer()
@@ -263,7 +263,7 @@ void timeMethodWithLongTaskTimerWhenCompleted() {
263263
completableFuture.join();
264264

265265
assertThat(registry.get("longCall")
266-
.tag("class", getClass().getName() + "$AsyncTimedService")
266+
.tag("class", AsyncTimedService.class.getName())
267267
.tag("method", "longCall")
268268
.tag("extra", "tag")
269269
.longTaskTimer()
@@ -283,7 +283,7 @@ void timeMethodWithLongTaskTimerWhenCompletedExceptionally() {
283283
CompletableFuture<?> completableFuture = service.longCall(guardedResult);
284284

285285
assertThat(registry.find("longCall")
286-
.tag("class", getClass().getName() + "$AsyncTimedService")
286+
.tag("class", AsyncTimedService.class.getName())
287287
.tag("method", "longCall")
288288
.tag("extra", "tag")
289289
.longTaskTimer()
@@ -293,7 +293,7 @@ void timeMethodWithLongTaskTimerWhenCompletedExceptionally() {
293293
assertThatThrownBy(completableFuture::join).isInstanceOf(CompletionException.class);
294294

295295
assertThat(registry.get("longCall")
296-
.tag("class", getClass().getName() + "$AsyncTimedService")
296+
.tag("class", AsyncTimedService.class.getName())
297297
.tag("method", "longCall")
298298
.tag("extra", "tag")
299299
.longTaskTimer()
@@ -313,13 +313,13 @@ void timeMethodWithLongTaskTimerWhenReturnCompletionStageNull() {
313313
assertThat(completableFuture).isNull();
314314

315315
assertThat(registry.get("longCallNull")
316-
.tag("class", getClass().getName() + "$AsyncTimedService")
316+
.tag("class", AsyncTimedService.class.getName())
317317
.tag("method", "longCallNull")
318318
.tag("extra", "tag")
319319
.longTaskTimers()).hasSize(1);
320320

321321
assertThat(registry.find("longCallNull")
322-
.tag("class", getClass().getName() + "$AsyncTimedService")
322+
.tag("class", AsyncTimedService.class.getName())
323323
.tag("method", "longCallNull")
324324
.tag("extra", "tag")
325325
.longTaskTimer()

0 commit comments

Comments
 (0)