File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
micrometer-test/src/test/java/io/micrometer/core/instrument/binder/jms Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1515 */
1616package io .micrometer .core .instrument .binder .jms ;
1717
18+ import java .time .Duration ;
1819import java .util .concurrent .CountDownLatch ;
1920import java .util .concurrent .TimeUnit ;
2021import java .util .stream .Stream ;
3536
3637import static org .assertj .core .api .Assertions .assertThat ;
3738import static org .assertj .core .api .Assertions .assertThatThrownBy ;
39+ import static org .awaitility .Awaitility .await ;
3840
3941/**
4042 * Tests for {@link JmsInstrumentation}.
@@ -134,10 +136,11 @@ void shouldInstrumentMessageListener() throws Exception {
134136 MessageProducer producer = session .createProducer (topic );
135137 producer .send (session .createTextMessage ("test send" ));
136138 assertThat (latch .await (2 , TimeUnit .SECONDS )).isTrue ();
137- TestObservationRegistryAssert .assertThat (registry )
138- .hasObservationWithNameEqualTo ("jms.message.process" )
139- .that ()
140- .hasContextualNameEqualTo ("test.send process" );
139+ await ().atMost (Duration .ofSeconds (1 ))
140+ .untilAsserted (() -> TestObservationRegistryAssert .assertThat (registry )
141+ .hasObservationWithNameEqualTo ("jms.message.process" )
142+ .that ()
143+ .hasContextualNameEqualTo ("test.send process" ));
141144 }
142145 }
143146
You can’t perform that action at this time.
0 commit comments