File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
hiero-enterprise-spring/src/test/java/com/openelements/hiero/spring/test Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -35,14 +35,24 @@ void testNullParam() {
3535 }
3636
3737 @ Test
38- void testFindTopicById () throws HieroException {
38+ void testFindTopicById () throws HieroException , InterruptedException {
3939 final TopicId topicId = topicClient .createTopic ();
40- topicClient .submitMessage (topicId , "topic test visibility " );
41- hieroTestUtils .waitForMirrorNodeRecords (); // Wait until the topic appears on mirror node via message
40+ topicClient .submitMessage (topicId , "trigger-indexing " );
41+ hieroTestUtils .waitForMirrorNodeRecords ();
4242
43- final Optional <Topic > result = topicRepository .findTopicById (topicId );
43+ Optional <Topic > result = Optional .empty ();
44+ long timeoutMillis = 10000 ;
45+ long startTime = System .currentTimeMillis ();
4446
45- Assertions .assertNotNull (result );
47+ while (System .currentTimeMillis () - startTime < timeoutMillis ) {
48+ result = topicRepository .findTopicById (topicId );
49+ if (result .isPresent ()) {
50+ break ;
51+ }
52+ Thread .sleep (500 );
53+ }
54+
55+ Assertions .assertNotNull (result , "Expected non-null Optional from topicRepository." );
4656 Assertions .assertTrue (result .isPresent (), "Expected topic to be present, but it was not found." );
4757 }
4858
You can’t perform that action at this time.
0 commit comments