1
1
/*
2
- * Copyright 2020-2022 the original author or authors.
2
+ * Copyright 2020-2023 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.
@@ -57,7 +57,7 @@ void testMicrometerHolderRecordSuccessWorksGracefullyAfterDestroy() {
57
57
given (beanProvider .getIfUnique ()).willReturn (meterRegistry );
58
58
59
59
MicrometerHolder micrometerHolder = new MicrometerHolder (ctx , "holderName" ,
60
- "timerName" , "timerDesc" , Collections .emptyMap ());
60
+ "timerName" , "timerDesc" , r -> Collections .emptyMap ());
61
61
Map <String , Timer > meters = (Map <String , Timer >) ReflectionTestUtils .getField (micrometerHolder , "meters" );
62
62
assertThat (meters ).hasSize (1 );
63
63
@@ -77,23 +77,23 @@ void testMicrometerHolderRecordSuccessWorksGracefullyAfterDestroy() {
77
77
@ Test
78
78
void multiReg () {
79
79
assertThatIllegalStateException ().isThrownBy (() -> new MicrometerHolder (
80
- new AnnotationConfigApplicationContext (Config1 .class ), "" , "" , "" , Collections .emptyMap ()))
80
+ new AnnotationConfigApplicationContext (Config1 .class ), "" , "" , "" , r -> Collections .emptyMap ()))
81
81
.withMessage ("No micrometer registry present (or more than one and "
82
82
+ "there is not exactly one marked with @Primary)" );
83
83
}
84
84
85
85
@ Test
86
86
void twoPrimaries () {
87
87
assertThatIllegalStateException ().isThrownBy (() -> new MicrometerHolder (
88
- new AnnotationConfigApplicationContext (Config2 .class ), "" , "" , "" , Collections .emptyMap ()))
88
+ new AnnotationConfigApplicationContext (Config2 .class ), "" , "" , "" , r -> Collections .emptyMap ()))
89
89
.withMessageContaining ("more than one 'primary' bean" );
90
90
}
91
91
92
92
@ Test
93
93
void primary () {
94
94
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext (Config3 .class );
95
95
MicrometerHolder micrometerHolder = new MicrometerHolder (ctx , "holderName" ,
96
- "timerName" , "timerDesc" , Collections .emptyMap ());
96
+ "timerName" , "timerDesc" , r -> Collections .emptyMap ());
97
97
@ SuppressWarnings ("unchecked" )
98
98
Map <String , Timer > meters = (Map <String , Timer >) ReflectionTestUtils .getField (micrometerHolder , "meters" );
99
99
assertThat (meters ).hasSize (1 );
0 commit comments