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 1919import  io .micrometer .core .instrument .search .MeterNotFoundException ;
2020import  io .micrometer .core .instrument .simple .SimpleMeterRegistry ;
2121
22+ import  static  org .junit .jupiter .api .Assertions .assertThrows ;
23+ import  static  org .junit .jupiter .api .Assertions .assertTrue ;
24+ 
2225
2326/** 
2427 *  @author Erin Schnabel 
@@ -136,10 +139,11 @@ public void testMicrometerMetrics() {
136139	}
137140
138141	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+ 
144148	}
145149}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments