File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
hibernate-micrometer/src/test/java/org/hibernate/test/stat Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 19
19
import io .micrometer .core .instrument .search .MeterNotFoundException ;
20
20
import io .micrometer .core .instrument .simple .SimpleMeterRegistry ;
21
21
22
+ import static org .junit .jupiter .api .Assertions .assertThrows ;
23
+ import static org .junit .jupiter .api .Assertions .assertTrue ;
24
+
22
25
23
26
/**
24
27
* @author Erin Schnabel
@@ -136,10 +139,11 @@ public void testMicrometerMetrics() {
136
139
}
137
140
138
141
void verifyMeterNotFoundException (String name ) {
139
- try {
140
- registry .get (name ).meter ();
141
- Assert .fail (name + " should not have been found" );
142
- } catch (MeterNotFoundException mnfe ) {
143
- }
142
+ MeterNotFoundException ex = assertThrows (
143
+ MeterNotFoundException .class ,
144
+ () -> registry .get ( name ).meter (), name + " should not have been found"
145
+ );
146
+ assertTrue ( ex .getMessage ().contains ( name ) );
147
+
144
148
}
145
149
}
You can’t perform that action at this time.
0 commit comments