fjtirado commented on code in PR #3477:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3477#discussion_r1574415342


##########
quarkus/addons/messaging/common/src/test/java/org/kie/kogito/addon/quarkus/messaging/common/QuarkusTopicDiscoveryTest.java:
##########
@@ -37,44 +33,66 @@
 class QuarkusTopicDiscoveryTest {
 
     @Test
-    @SetSystemProperty(key = 
"mp.messaging.outgoing.processedtravellers.connector", value = "quarkus-http")
-    @SetSystemProperty(key = "mp.messaging.outgoing.processedtravellers.url", 
value = "http://localhost:8080/";)
-    @SetSystemProperty(key = 
"mp.messaging.incoming.kogito_incoming_stream.connector", value = 
"smallrye-kafka")
-    @SetSystemProperty(key = 
"mp.messaging.incoming.kogito_incoming_stream.topic", value = "mycooltopic")
     void verifyTopicsWithPropertiesSet() {
         final List<Topic> expectedTopics = new ArrayList<>();
         expectedTopics.add(new Topic("processedtravellers", 
ChannelType.OUTGOING));
         expectedTopics.add(new Topic("mycooltopic", ChannelType.INCOMING));
 
-        final TopicDiscovery discovery = new QuarkusTopicDiscovery();
+        final TopicDiscovery discovery = new QuarkusTopicDiscovery() {
+            final Map<String, String> properties = new HashMap<>() {
+                {
+                    put("mp.messaging.outgoing.processedtravellers.connector", 
"quarkus-http");
+                    put("mp.messaging.outgoing.processedtravellers.url", 
"http://localhost:8080/";);
+                    
put("mp.messaging.incoming.kogito_incoming_stream.connector", "smallrye-kafka");
+                    put("mp.messaging.incoming.kogito_incoming_stream.topic", 
"mycooltopic");
+                }
+            };
+
+            Iterable<String> getPropertyNames() {
+                return properties.keySet();
+            }
+
+            Optional<String> getOptionalValue(String key) {
+                return Optional.ofNullable(properties.get(key));
+            }
+        };
         final List<Topic> topics = 
discovery.getTopics(Collections.emptyList());
         assertThat(topics).hasSize(2);
         expectedTopics.forEach(e -> assertThat(topics.stream().anyMatch(t -> 
t.getName().equals(e.getName()) && t.getType() == e.getType())).isTrue());
     }
 
     @Test
-    @SetSystemProperty(key = 
"mp.messaging.outgoing.processedtravellers.connector", value = "quarkus-http")
-    @SetSystemProperty(key = "mp.messaging.outgoing.processedtravellers.url", 
value = "http://localhost:8080/";)
-    @SetSystemProperty(key = 
"mp.messaging.outgoing.processedtravellers.topic", value = "mycooltopic")
-    @SetSystemProperty(key = 
"mp.messaging.incoming.kogito_incoming_stream.connector", value = 
"smallrye-kafka")
-    @SetSystemProperty(key = 
"mp.messaging.incoming.kogito_incoming_stream.topic", value = "mycooltopic")
     void verifyTopicsWithPropertiesSameTopic() {
         final List<Topic> expectedTopics = new ArrayList<>();
         expectedTopics.add(new Topic("mycooltopic", ChannelType.OUTGOING));
         expectedTopics.add(new Topic("mycooltopic", ChannelType.INCOMING));
 
-        final TopicDiscovery discovery = new QuarkusTopicDiscovery();
+        final TopicDiscovery discovery = new QuarkusTopicDiscovery() {
+            final Map<String, String> properties = new HashMap<>() {
+                {
+                    put("mp.messaging.outgoing.processedtravellers.connector", 
"quarkus-http");
+                    put("mp.messaging.outgoing.processedtravellers.url", 
"http://localhost:8080/";);
+                    put("mp.messaging.outgoing.processedtravellers.topic", 
"mycooltopic");
+                    
put("mp.messaging.incoming.kogito_incoming_stream.connector", "smallrye-kafka");
+                    put("mp.messaging.incoming.kogito_incoming_stream.topic", 
"mycooltopic");
+                }
+            };
+
+            Iterable<String> getPropertyNames() {
+                return properties.keySet();

Review Comment:
   same here, actually, to avoid code duplication (which I agree in test is 
mostly irrelevant) this probably deserve an inner class, 
TestQuarkusTopicDiscovery, with a constructor that accept a Map. Also, for an 
unmodifiable Map of reduced size like this one, Map.of should be used  rather 
than the map initializer construct. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to