Source:
<code>public void sendPartitionedRegionClearMessageSendsClearMessageToPRNodes() { RegionEventImpl regionEvent = mock(RegionEventImpl.class); when(regionEvent.clone()).thenReturn(mock(RegionEventImpl.class)); Region<String, PartitionRegionConfig> prRoot = mock(Region.class); when(partitionedRegion.getPRRoot()).thenReturn(prRoot); InternalDistributedMember member = mock(InternalDistributedMember.class); RegionAdvisor regionAdvisor = mock(RegionAdvisor.class); <START> Set<InternalDistributedMember> prNodes = new HashSet<>(); prNodes.add(member); Node node = mock(Node.class); when(node.getMemberId()).thenReturn(member); Set<Node> configNodes = new HashSet<>(); configNodes.add(node); <END> when(regionAdvisor.adviseAllPRNodes()).thenReturn(prNodes); when(partitionedRegion.getRegionAdvisor()).thenReturn(regionAdvisor); PartitionRegionConfig partitionRegionConfig = mock(PartitionRegionConfig.class); when(partitionRegionConfig.getNodes()).thenReturn(configNodes); when(prRoot.get(any())).thenReturn(partitionRegionConfig); InternalDistributedSystem internalDistributedSystem = mock(InternalDistributedSystem.class); when(internalDistributedSystem.getDistributionManager()).thenReturn(distributionManager); when(partitionedRegion.getSystem()).thenReturn(internalDistributedSystem); when(partitionedRegion.isTransactionDistributed()).thenReturn(false); when(distributionManager.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); when(distributionManager.getStats()).thenReturn(mock(DMStats.class)); partitionedRegionClear.sendPartitionedRegionClearMessage(regionEvent, PartitionedRegionClearMessage.OperationType.OP_PR_CLEAR); verify(distributionManager, times(1)).putOutgoing(any()); }</code><technical_language>Small suggestion; instead Set<InternalDistributedMember> prNodes = Collections.singleton(member); Set<Node> configNodes = Collections.singleton(node); condense code a little</technical_language>

Target:
public void sendPartitionedRegionClearMessageSendsClearMessageToPRNodes() { RegionEventImpl regionEvent = mock(RegionEventImpl.class); when(regionEvent.clone()).thenReturn(mock(RegionEventImpl.class)); Region<String, PartitionRegionConfig> prRoot = mock(Region.class); when(partitionedRegion.getPRRoot()).thenReturn(prRoot); InternalDistributedMember member = mock(InternalDistributedMember.class); RegionAdvisor regionAdvisor = mock(RegionAdvisor.class); Set<InternalDistributedMember> prNodes = Collections.singleton(member); Node node = mock(Node.class); when(node.getMemberId()).thenReturn(member); Set<Node> configNodes = Collections.singleton(node); when(regionAdvisor.adviseAllPRNodes()).thenReturn(prNodes); when(partitionedRegion.getRegionAdvisor()).thenReturn(regionAdvisor); PartitionRegionConfig partitionRegionConfig = mock(PartitionRegionConfig.class); when(partitionRegionConfig.getNodes()).thenReturn(configNodes); when(prRoot.get(any())).thenReturn(partitionRegionConfig); InternalDistributedSystem internalDistributedSystem = mock(InternalDistributedSystem.class); when(internalDistributedSystem.getDistributionManager()).thenReturn(distributionManager); when(partitionedRegion.getSystem()).thenReturn(internalDistributedSystem); InternalCache internalCache = mock(InternalCache.class); TXManagerImpl txManager = mock(TXManagerImpl.class); when(txManager.isDistributed()).thenReturn(false); when(internalCache.getTxManager()).thenReturn(txManager); when(partitionedRegion.getCache()).thenReturn(internalCache); when(distributionManager.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); when(distributionManager.getStats()).thenReturn(mock(DMStats.class)); partitionedRegionClear.sendPartitionedRegionClearMessage(regionEvent, PartitionedRegionClearMessage.OperationType.OP_PR_CLEAR); verify(distributionManager, times(1)).putOutgoing(any()); }