mdedetrich commented on code in PR #12725:
URL: https://github.com/apache/kafka/pull/12725#discussion_r990348417


##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/rest/resources/ConnectorsResourceTest.java:
##########
@@ -175,85 +183,69 @@ private static Map<String, String> 
getConnectorConfig(Map<String, String> mapToC
 
     @Test
     public void testListConnectors() {
-        final Capture<Callback<Collection<String>>> cb = Capture.newInstance();
-        
EasyMock.expect(herder.connectors()).andReturn(Arrays.asList(CONNECTOR2_NAME, 
CONNECTOR_NAME));
-
-        PowerMock.replayAll();
+        when(herder.connectors()).thenReturn(Arrays.asList(CONNECTOR2_NAME, 
CONNECTOR_NAME));
 
         Collection<String> connectors = (Collection<String>) 
connectorsResource.listConnectors(forward, NULL_HEADERS).getEntity();
         // Ordering isn't guaranteed, compare sets
         assertEquals(new HashSet<>(Arrays.asList(CONNECTOR_NAME, 
CONNECTOR2_NAME)), new HashSet<>(connectors));
-
-        PowerMock.verifyAll();
     }
 
     @Test
     public void testExpandConnectorsStatus() {
-        
EasyMock.expect(herder.connectors()).andReturn(Arrays.asList(CONNECTOR2_NAME, 
CONNECTOR_NAME));
-        ConnectorStateInfo connector = EasyMock.mock(ConnectorStateInfo.class);
-        ConnectorStateInfo connector2 = 
EasyMock.mock(ConnectorStateInfo.class);
-        
EasyMock.expect(herder.connectorStatus(CONNECTOR2_NAME)).andReturn(connector2);
-        
EasyMock.expect(herder.connectorStatus(CONNECTOR_NAME)).andReturn(connector);
+        when(herder.connectors()).thenReturn(Arrays.asList(CONNECTOR2_NAME, 
CONNECTOR_NAME));
+        ConnectorStateInfo connector = mock(ConnectorStateInfo.class);
+        ConnectorStateInfo connector2 = mock(ConnectorStateInfo.class);
+        when(herder.connectorStatus(CONNECTOR2_NAME)).thenReturn(connector2);
+        when(herder.connectorStatus(CONNECTOR_NAME)).thenReturn(connector);
 
-        forward = EasyMock.mock(UriInfo.class);
+        forward = mock(UriInfo.class);
         MultivaluedMap<String, String> queryParams = new 
MultivaluedHashMap<>();
         queryParams.putSingle("expand", "status");
-        
EasyMock.expect(forward.getQueryParameters()).andReturn(queryParams).anyTimes();
-        EasyMock.replay(forward);
-
-        PowerMock.replayAll();
+        when(forward.getQueryParameters()).thenReturn(queryParams);
 
         Map<String, Map<String, Object>> expanded = (Map<String, Map<String, 
Object>>) connectorsResource.listConnectors(forward, NULL_HEADERS).getEntity();
         // Ordering isn't guaranteed, compare sets
         assertEquals(new HashSet<>(Arrays.asList(CONNECTOR_NAME, 
CONNECTOR2_NAME)), expanded.keySet());
         assertEquals(connector2, expanded.get(CONNECTOR2_NAME).get("status"));
         assertEquals(connector, expanded.get(CONNECTOR_NAME).get("status"));
-        PowerMock.verifyAll();
     }
 
     @Test
     public void testExpandConnectorsInfo() {
-        
EasyMock.expect(herder.connectors()).andReturn(Arrays.asList(CONNECTOR2_NAME, 
CONNECTOR_NAME));
-        ConnectorInfo connector = EasyMock.mock(ConnectorInfo.class);
-        ConnectorInfo connector2 = EasyMock.mock(ConnectorInfo.class);
-        
EasyMock.expect(herder.connectorInfo(CONNECTOR2_NAME)).andReturn(connector2);
-        
EasyMock.expect(herder.connectorInfo(CONNECTOR_NAME)).andReturn(connector);
+        when(herder.connectors()).thenReturn(Arrays.asList(CONNECTOR2_NAME, 
CONNECTOR_NAME));
+        ConnectorInfo connector = mock(ConnectorInfo.class);
+        ConnectorInfo connector2 = mock(ConnectorInfo.class);

Review Comment:
   So this variable is completely unused and if deleted the test still passes, 
I don't think its necessary for the test?



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to