jsancio commented on a change in pull request #11593:
URL: https://github.com/apache/kafka/pull/11593#discussion_r766913504



##########
File path: 
metadata/src/test/java/org/apache/kafka/controller/ClusterControlManagerTest.java
##########
@@ -84,6 +90,27 @@ public void testReplay() {
         assertTrue(clusterControl.unfenced(1));
     }
 
+    @Test
+    public void testRegistrationWithIncorrectClusterId() throws Exception {
+        SnapshotRegistry snapshotRegistry = new SnapshotRegistry(new 
LogContext());
+        ClusterControlManager clusterControl = new ClusterControlManager(
+            new LogContext(), "fPZv1VBsRFmnlRvmGcOW9w", new MockTime(0, 0, 0),
+            snapshotRegistry, 1000,
+            new StripedReplicaPlacer(new Random()), new 
MockControllerMetrics());
+        clusterControl.activate();
+        try {
+            clusterControl.registerBroker(new BrokerRegistrationRequestData().
+                    setClusterId("WIjw3grwRZmR2uOpdpVXbg").
+                    setBrokerId(0).
+                    setRack(null).
+                    
setIncarnationId(Uuid.fromString("0H4fUu1xQEKXFYwB1aBjhg")),
+                123L,
+                new FeatureMapAndEpoch(new FeatureMap(Collections.emptyMap()), 
456L));
+            Assertions.fail("Expected exception");

Review comment:
       Did you consider using `Assertion.assertThrows`?




-- 
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]


Reply via email to