Source:
<code>public void setup() { BaseManagementService baseManagementService = mock(BaseManagementService.class); DistributedSystemMXBean distributedSystemMXBean = mock(DistributedSystemMXBean.class); DistributedRegionMXBean distributedRegionMXBean = mock(DistributedRegionMXBean.class); server1 = mock(InternalDistributedMember.class); server2 = mock(InternalDistributedMember.class); internalCacheForClientAccess = mock(InternalCacheForClientAccess.class); InternalDistributedSystem internalDistributedSystem = mock(InternalDistributedSystem.class); DistributionManager distributionManager = mock(DistributionManager.class); when(baseManagementService.getDistributedSystemMXBean()).thenReturn(distributedSystemMXBean); <START> when(baseManagementService.getDistributedRegionMXBean(Mockito.anyString())) <END> .thenReturn(distributedRegionMXBean); when(distributedRegionMXBean.getRegionType()).thenReturn(String.valueOf(DataPolicy.PARTITION)); when(distributedRegionMXBean.getMembers()) .thenReturn(new String[] {DS_MEMBER_NAME_SERVER1, DS_MEMBER_NAME_SERVER2}); when(server1.getName()).thenReturn(DS_MEMBER_NAME_SERVER1); when(server2.getName()).thenReturn(DS_MEMBER_NAME_SERVER2); when(distributedSystemMXBean.listRegions()).thenReturn(new String[] {REGION_1}); when(internalDistributedSystem.getDistributionManager()) .thenReturn(distributionManager); Set<InternalDistributedMember> dsMembers = new HashSet<>(); dsMembers.add(server1); dsMembers.add(server2); when(distributionManager.getDistributionManagerIds()).thenReturn(dsMembers); BaseManagementService.setManagementService(internalCacheForClientAccess, baseManagementService); when(((InternalCache) internalCacheForClientAccess).getCacheForProcessingClientRequests()) .thenReturn(internalCacheForClientAccess); when(internalCacheForClientAccess.getInternalDistributedSystem()) .thenReturn(internalDistributedSystem); when(server1.getVersionObject()) .thenReturn(RestoreRedundancyPerformer.ADDED_VERSION); when(server2.getVersionObject()) .thenReturn(RestoreRedundancyPerformer.ADDED_VERSION); restoreRedundancyPerformer = new RestoreRedundancyPerformer(); }</code><technical_language>of Mockito.***** matchers in this class owned org.mockito.ArgumentMatchers. I recommend converting static import switch importing ArgumentMatchers</technical_language>

Target:
public void setup() { BaseManagementService baseManagementService = mock(BaseManagementService.class); DistributedSystemMXBean distributedSystemMXBean = mock(DistributedSystemMXBean.class); DistributedRegionMXBean distributedRegionMXBean = mock(DistributedRegionMXBean.class); server1 = mock(InternalDistributedMember.class); server2 = mock(InternalDistributedMember.class); internalCacheForClientAccess = mock(InternalCacheForClientAccess.class); InternalDistributedSystem internalDistributedSystem = mock(InternalDistributedSystem.class); DistributionManager distributionManager = mock(DistributionManager.class); when(baseManagementService.getDistributedSystemMXBean()).thenReturn(distributedSystemMXBean); when(baseManagementService.getDistributedRegionMXBean(anyString())) .thenReturn(distributedRegionMXBean); when(distributedRegionMXBean.getRegionType()).thenReturn(String.valueOf(DataPolicy.PARTITION)); when(distributedRegionMXBean.getMembers()) .thenReturn(new String[] {DS_MEMBER_NAME_SERVER1, DS_MEMBER_NAME_SERVER2}); when(server1.getName()).thenReturn(DS_MEMBER_NAME_SERVER1); when(server2.getName()).thenReturn(DS_MEMBER_NAME_SERVER2); when(distributedSystemMXBean.listRegions()).thenReturn(new String[] {REGION_1}); when(internalDistributedSystem.getDistributionManager()) .thenReturn(distributionManager); Set<InternalDistributedMember> dsMembers = new HashSet<>(); dsMembers.add(server1); dsMembers.add(server2); when(distributionManager.getDistributionManagerIds()).thenReturn(dsMembers); BaseManagementService.setManagementService(internalCacheForClientAccess, baseManagementService); when(((InternalCache) internalCacheForClientAccess).getCacheForProcessingClientRequests()) .thenReturn(internalCacheForClientAccess); when(internalCacheForClientAccess.getInternalDistributedSystem()) .thenReturn(internalDistributedSystem); when(server1.getVersionObject()) .thenReturn(RestoreRedundancyPerformer.ADDED_VERSION); when(server2.getVersionObject()) .thenReturn(RestoreRedundancyPerformer.ADDED_VERSION); restoreRedundancyPerformer = new RestoreRedundancyPerformer(); }