ExecuteRegionFunction66 extends BaseCommand { Set<Object> populateRemovedNodes(Message clientMessage, int removedNodesSize, int partNumber) throws IOException, ClassNotFoundException { Set<Object> removedNodesSet = null; if (removedNodesSize != 0) { removedNodesSet = new HashSet<Object>(); partNumber = partNumber + 1; for (int i = 0; i < removedNodesSize; i++) { removedNodesSet.add(clientMessage.getPart(partNumber + i).getStringOrObject()); } } return removedNodesSet; } ExecuteRegionFunction66(); static Command getCommand(); @Override void cmdExecute(final Message clientMessage, final ServerConnection serverConnection,
      final SecurityService securityService, long start);  }
@Test public void populateRemovedNodexWillReturnNodesReadFromClient() throws Exception { AbstractExecution execution = mock(AbstractExecution.class); when(execution.execute(functionObject)).thenReturn(mock(ResultCollector.class)); Message clientMessage = mock(Message.class); Part part1 = mock(Part.class); Object object1 = new Object(); when(part1.getStringOrObject()).thenReturn(object1); Part part2 = mock(Part.class); Object object2 = new Object(); when(part2.getStringOrObject()).thenReturn(object2); Part part3 = mock(Part.class); Object object3 = new Object(); when(part3.getStringOrObject()).thenReturn(object3); when(clientMessage.getPart(7)).thenReturn(part1); when(clientMessage.getPart(8)).thenReturn(part2); when(clientMessage.getPart(9)).thenReturn(part3); Set nodes = this.executeRegionFunction66.populateRemovedNodes(clientMessage, 3, 6); assertTrue(nodes.contains(object1)); assertTrue(nodes.contains(object2)); assertTrue(nodes.contains(object3)); }