org.mockito.ArgumentCaptor - java examples

Here are the examples of the java api org.mockito.ArgumentCaptor taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

155 Examples 7

19 View Complete Implementation : KeySetTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    doThrow(new NotAuthorizedException("")).when(this.authzRequest).keySetAuthorize(eq(REGION_NAME));
    this.keySet.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    verify(this.authzRequest).keySetAuthorize(eq(REGION_NAME));
    ArgumentCaptor<NotAuthorizedException> argument = ArgumentCaptor.forClreplaced(NotAuthorizedException.clreplaced);
    verify(this.chunkedResponseMessage).addObjPart(argument.capture());
    replacedertThat(argument.getValue()).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : EntryEventSerializationTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void newValueIsSerializableUsesItsSerializedValue() {
    String newValue = "newValue";
    when(event.basicGetNewValue()).thenReturn(newValue);
    instance.serializeNewValueIfNeeded(region, event);
    ArgumentCaptor<byte[]> captor = ArgumentCaptor.forClreplaced(byte[].clreplaced);
    verify(event, times(1)).setCachedSerializedNewValue(captor.capture());
    replacedertThat(captor.getValue()).isEqualTo(EntryEventImpl.serialize(newValue));
}

19 View Complete Implementation : RegisterInterestList66Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    doThrow(new NotAuthorizedException("")).when(this.authzRequest).registerInterestListAuthorize(eq(REGION_NAME), any(), any());
    this.registerInterestList66.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    verify(this.authzRequest).registerInterestListAuthorize(eq(REGION_NAME), any(), any());
    ArgumentCaptor<NotAuthorizedException> argument = ArgumentCaptor.forClreplaced(NotAuthorizedException.clreplaced);
    verify(this.chunkedResponseMessage).addObjPart(argument.capture());
    replacedertThat(argument.getValue()).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    verify(this.chunkedResponseMessage).sendChunk(this.serverConnection);
}

19 View Complete Implementation : GetAllTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void integratedSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(true);
    for (Object key : KEYS) {
        doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, key.toString());
    }
    this.getAll.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    for (Object key : KEYS) {
        verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, key.toString());
    }
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPart(argument.capture(), eq(false));
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object key : argument.getValue().getObjects()) {
        replacedertThat(key).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : StartupMessageJUnitTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void processShouldSendAReplyMessageWhenErrorThrownForNoResponse() {
    ClusterDistributionManager distributionManager = mock(ClusterDistributionManager.clreplaced);
    InternalDistributedMember id = mock(InternalDistributedMember.clreplaced);
    when(distributionManager.getId()).thenReturn(id);
    // This method will throw an error in the middle of StartupMessage.process
    when(distributionManager.getTransport()).thenThrow(new Error("No Response sent"));
    StartupMessage startupMessage = new StartupMessage();
    startupMessage.setSender(id);
    replacedertThatThrownBy(() -> startupMessage.process(distributionManager)).isInstanceOf(Error.clreplaced).hasMessage("No Response sent");
    // We expect process to send a ReplyMessage with an exception
    // So that the sender is not blocked
    ArgumentCaptor<DistributionMessage> responseCaptor = ArgumentCaptor.forClreplaced(DistributionMessage.clreplaced);
    verify(distributionManager).putOutgoing(responseCaptor.capture());
    DistributionMessage response = responseCaptor.getValue();
    replacedertThat(response).isInstanceOf(ReplyMessage.clreplaced);
    replacedertThat(((ReplyMessage) response).getException()).isInstanceOf(ReplyException.clreplaced).hasCauseInstanceOf(IllegalStateException.clreplaced);
}

19 View Complete Implementation : LoginHandlerInterceptorRequestHeaderTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void testCaseInsensitive() throws Exception {
    MockHttpServletRequest mockRequest = new MockHttpServletRequest();
    mockRequest.addHeader("Security-Username", "John");
    mockRequest.addHeader("Security-Preplacedword", "Preplacedword");
    mockRequest.addHeader("security-something", "anything");
    mockRequest.addHeader("Content-Type", "application/json");
    interceptor.preHandle(mockRequest, null, null);
    ArgumentCaptor<Properties> props = ArgumentCaptor.forClreplaced(Properties.clreplaced);
    verify(securityService).login(props.capture());
    replacedertThat(props.getValue().getProperty("security-username")).isEqualTo("John");
    replacedertThat(props.getValue().getProperty("security-preplacedword")).isEqualTo("Preplacedword");
    Map<String, String> env = interceptor.getEnvironment();
    // make sure security-* are not put in the environment variable
    replacedertThat(env).hreplacedize(0);
}

19 View Complete Implementation : StartServerCommandIntegrationTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void startServerRespectsJmxManagerHostnameForClients() throws Exception {
    String startServerCommand = new CommandStringBuilder("start server").addOption(JMX_MANAGER_HOSTNAME_FOR_CLIENTS, FAKE_HOSTNAME).toString();
    commandRule.executeAndreplacedertThat(spy, startServerCommand);
    ArgumentCaptor<Properties> gemfirePropertiesCaptor = ArgumentCaptor.forClreplaced(Properties.clreplaced);
    verify(spy).createStartServerCommandLine(any(), any(), any(), gemfirePropertiesCaptor.capture(), any(), any(), any(), any(), any(), any());
    Properties gemfireProperties = gemfirePropertiesCaptor.getValue();
    replacedertThat(gemfireProperties).containsKey(JMX_MANAGER_HOSTNAME_FOR_CLIENTS);
    replacedertThat(gemfireProperties.get(JMX_MANAGER_HOSTNAME_FOR_CLIENTS)).isEqualTo(FAKE_HOSTNAME);
}

19 View Complete Implementation : GetAllTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void integratedSecurityShouldSucceedIfAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(true);
    this.getAll.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPart(argument.capture(), eq(false));
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object key : argument.getValue().getKeys()) {
        replacedertThat(key).isIn(KEYS);
    }
    for (Object key : KEYS) {
        verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, key.toString());
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : ClientServerSessionCacheJUnitTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void createRegionFunctionFailsOnServer() {
    ArgumentCaptor<String> stringCaptor = ArgumentCaptor.forClreplaced(String.clreplaced);
    regionStatusResultList.clear();
    regionStatusResultList.add(RegionStatus.INVALID);
    replacedertThatThrownBy(() -> sessionCache.initialize()).isInstanceOf(IllegalStateException.clreplaced).hasCauseInstanceOf(IllegalStateException.clreplaced).hasMessageContaining("An exception occurred on the server while attempting to create or validate region named " + sessionRegionName + ". See the server log for additional details.");
    verify(logger).fatal(stringCaptor.capture(), any(Exception.clreplaced));
    replacedertThat(stringCaptor.getValue()).isEqualTo("Unable to create or retrieve region");
}

19 View Complete Implementation : GetAllTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    for (Object key : KEYS) {
        doThrow(new NotAuthorizedException("")).when(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(key.toString()), eq(null));
    }
    this.getAll.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPart(argument.capture(), eq(false));
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object o : argument.getValue().getObjects()) {
        replacedertThat(o).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    }
    for (Object key : KEYS) {
        verify(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(key.toString()), eq(null));
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : GetAll651Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldSucceedIfAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    this.getAll651.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPart(argument.capture(), eq(false));
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object key : argument.getValue().getKeys()) {
        replacedertThat(key).isIn(KEYS);
    }
    for (Object key : KEYS) {
        verify(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(key.toString()), eq(null));
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : GetAllWithCallbackTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    for (Object key : KEYS) {
        doThrow(new NotAuthorizedException("")).when(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(key.toString()), eq(null));
    }
    this.getAll70.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPartNoCopying(argument.capture());
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object o : argument.getValue().getObjects()) {
        replacedertThat(o).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    }
    for (Object key : KEYS) {
        verify(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(key.toString()), eq(null));
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : PutTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    doThrow(new NotAuthorizedException("")).when(this.authzRequest).putAuthorize(eq(REGION_NAME), eq(KEY), eq(VALUE), eq(true), eq(CALLBACK_ARG));
    this.put.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    verify(this.authzRequest).putAuthorize(eq(REGION_NAME), eq(KEY), eq(VALUE), eq(true), eq(CALLBACK_ARG));
    ArgumentCaptor<NotAuthorizedException> argument = ArgumentCaptor.forClreplaced(NotAuthorizedException.clreplaced);
    verify(this.errorResponseMessage).addObjPart(argument.capture());
    replacedertThat(argument.getValue()).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    verify(this.errorResponseMessage).send(this.serverConnection);
}

19 View Complete Implementation : GetAllWithCallbackTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void integratedSecurityShouldSucceedIfAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(true);
    this.getAll70.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPartNoCopying(argument.capture());
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object key : argument.getValue().getKeys()) {
        replacedertThat(key).isIn(KEYS);
    }
    for (Object key : KEYS) {
        verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, key.toString());
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : Put61Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    doThrow(new NotAuthorizedException("")).when(this.authzRequest).putAuthorize(eq(REGION_NAME), eq(KEY), eq(null), eq(true), eq(CALLBACK_ARG));
    this.put61.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    verify(this.authzRequest).putAuthorize(eq(REGION_NAME), eq(KEY), eq(null), eq(true), eq(CALLBACK_ARG));
    ArgumentCaptor<NotAuthorizedException> argument = ArgumentCaptor.forClreplaced(NotAuthorizedException.clreplaced);
    verify(this.errorResponseMessage).addObjPart(argument.capture());
    replacedertThat(argument.getValue()).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    verify(this.errorResponseMessage).send(this.serverConnection);
}

19 View Complete Implementation : LuceneIndexStatsJUnitTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void shouldPollSuppliersForDoreplacedentStat() {
    stats.addDoreplacedentsSupplier(() -> 5);
    stats.addDoreplacedentsSupplier(() -> 3);
    int doreplacedentsId = type.nameToId("doreplacedents");
    ArgumentCaptor<IntSupplier> doreplacedentsSupplierCaptor = ArgumentCaptor.forClreplaced(IntSupplier.clreplaced);
    verify(statistics).setIntSupplier(eq(doreplacedentsId), doreplacedentsSupplierCaptor.capture());
    IntSupplier doreplacedentsSuppler = doreplacedentsSupplierCaptor.getValue();
    replacedertEquals(8, doreplacedentsSuppler.getAsInt());
}

19 View Complete Implementation : GetAll651Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    for (Object key : KEYS) {
        doThrow(new NotAuthorizedException("")).when(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(key.toString()), eq(null));
    }
    this.getAll651.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPart(argument.capture(), eq(false));
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object o : argument.getValue().getObjects()) {
        replacedertThat(o).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    }
    for (Object key : KEYS) {
        verify(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(key.toString()), eq(null));
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : ProtobufServerConnectionTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void doOneMessageNotifiesClientHealthMonitorOfPing() throws IOException {
    when(cachedRegionHelper.getCache()).thenReturn(cache);
    ServerConnection serverConnection = new ProtobufServerConnection(socket, cache, cachedRegionHelper, mock(CacheServerStats.clreplaced), 0, 1024, "", CommunicationMode.ProtobufClientServerProtocol.getModeNumber(), acceptor, mock(ClientProtocolProcessor.clreplaced), mock(SecurityService.clreplaced));
    serverConnection.doOneMessage();
    ArgumentCaptor<ClientProxyMembershipID> clientProxyMembershipIdFromReceivedPing = forClreplaced(ClientProxyMembershipID.clreplaced);
    verify(clientHealthMonitor).receivedPing(clientProxyMembershipIdFromReceivedPing.capture());
    replacedertThat(clientProxyMembershipIdFromReceivedPing.getValue().toString()).isEqualTo("idenreplacedy(localhost<ec>:0,connection=1");
}

19 View Complete Implementation : GatewayManagementControllerSpringTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void getGatewayReceiverMappingRecognizesReceiverIdWithDot() throws Exception {
    String receiverIdWithDot = "receiver.id";
    String requestPath = URI_VERSION + GATEWAY_RECEIVERS_ENDPOINTS + "/" + receiverIdWithDot;
    when(cms.get(any())).thenReturn(new ClusterManagementGetResult<>());
    context.perform(get(requestPath)).andExpect(status().is2xxSuccessful());
    ArgumentCaptor<GatewayReceiver> gatewayReceiverCaptor = ArgumentCaptor.forClreplaced(GatewayReceiver.clreplaced);
    verify(cms).get(gatewayReceiverCaptor.capture());
    replacedertThat(gatewayReceiverCaptor.getValue().getId()).isEqualTo(receiverIdWithDot);
}

19 View Complete Implementation : IndexRepositoryImplJUnitTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void addingDoreplacedentsShouldUpdateDoreplacedentsStat() throws IOException {
    repo.create("key1", new Type2("bar", 1, 2L, 3.0, 4.0f, "Grape Ape doughnut"));
    repo.commit();
    ArgumentCaptor<IntSupplier> captor = ArgumentCaptor.forClreplaced(IntSupplier.clreplaced);
    verify(stats).addDoreplacedentsSupplier(captor.capture());
    IntSupplier supplier = captor.getValue();
    replacedertEquals(1, supplier.getAsInt());
}

19 View Complete Implementation : GetAllWithCallbackTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldSucceedIfAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    this.getAll70.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPartNoCopying(argument.capture());
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object key : argument.getValue().getKeys()) {
        replacedertThat(key).isIn(KEYS);
    }
    for (Object key : KEYS) {
        verify(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(key.toString()), eq(null));
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : LuceneIndexStatsJUnitTest.java
Copyright Apache License 2.0
Author : apache
@Before
public void createStats() {
    StatisticsFactory statsFactory = mock(StatisticsFactory.clreplaced);
    statistics = mock(Statistics.clreplaced);
    when(statsFactory.createAtomicStatistics(any(), anyString())).thenReturn(statistics);
    stats = new LuceneIndexStats(statsFactory, "region-index");
    ArgumentCaptor<StatisticsType> statsTypeCaptor = ArgumentCaptor.forClreplaced(StatisticsType.clreplaced);
    verify(statsFactory).createAtomicStatistics(statsTypeCaptor.capture(), anyString());
    type = statsTypeCaptor.getValue();
}

19 View Complete Implementation : InvalidateTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    doThrow(new NotAuthorizedException("")).when(this.authzRequest).invalidateAuthorize(eq(REGION_NAME), eq(KEY_STRING), eq(CALLBACK_ARG));
    this.invalidate.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    verify(this.authzRequest).invalidateAuthorize(eq(REGION_NAME), eq(KEY_STRING), eq(CALLBACK_ARG));
    ArgumentCaptor<NotAuthorizedException> argument = ArgumentCaptor.forClreplaced(NotAuthorizedException.clreplaced);
    verify(this.errorResponseMessage).addObjPart(argument.capture());
    replacedertThat(argument.getValue()).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    verify(this.errorResponseMessage).send(this.serverConnection);
}

19 View Complete Implementation : GetAllTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldSucceedIfAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    this.getAll.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPart(argument.capture(), eq(false));
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object key : argument.getValue().getKeys()) {
        replacedertThat(key).isIn(KEYS);
    }
    for (Object key : KEYS) {
        verify(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(key.toString()), eq(null));
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : GetAllWithCallbackTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void integratedSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(true);
    for (Object key : KEYS) {
        doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, key.toString());
    }
    this.getAll70.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    for (Object key : KEYS) {
        verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, key.toString());
    }
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPartNoCopying(argument.capture());
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object key : argument.getValue().getObjects()) {
        replacedertThat(key).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : RegisterInterestTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    doThrow(new NotAuthorizedException("")).when(this.authzRequest).registerInterestAuthorize(eq(REGION_NAME), eq(KEY), anyInt(), any());
    this.registerInterest.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    verify(this.authzRequest).registerInterestAuthorize(eq(REGION_NAME), eq(KEY), anyInt(), any());
    ArgumentCaptor<NotAuthorizedException> argument = ArgumentCaptor.forClreplaced(NotAuthorizedException.clreplaced);
    verify(this.chunkedResponseMessage).addObjPart(argument.capture());
    replacedertThat(argument.getValue()).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    verify(this.chunkedResponseMessage).sendChunk(this.serverConnection);
}

19 View Complete Implementation : Put65Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    doThrow(new NotAuthorizedException("")).when(this.authzRequest).putAuthorize(eq(REGION_NAME), eq(KEY), eq(VALUE), eq(true), eq(CALLBACK_ARG));
    this.put65.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    verify(this.authzRequest).putAuthorize(eq(REGION_NAME), eq(KEY), eq(VALUE), eq(true), eq(CALLBACK_ARG));
    ArgumentCaptor<NotAuthorizedException> argument = ArgumentCaptor.forClreplaced(NotAuthorizedException.clreplaced);
    verify(this.errorResponseMessage).addObjPart(argument.capture());
    replacedertThat(argument.getValue()).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    verify(this.errorResponseMessage).send(this.serverConnection);
}

19 View Complete Implementation : GetAll70Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldSucceedIfAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    this.getAll70.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPartNoCopying(argument.capture());
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object key : argument.getValue().getKeys()) {
        replacedertThat(key).isIn(KEYS);
    }
    for (Object key : KEYS) {
        verify(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(key.toString()), eq(null));
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : StartLocatorCommandIntegrationTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void startLocatorRespectsHostnameForClients() throws Exception {
    doReturn(mock(Process.clreplaced)).when(spy).getProcess(any(), any());
    String startLocatorCommand = new CommandStringBuilder("start locator").addOption("hostname-for-clients", FAKE_HOSTNAME).toString();
    commandRule.executeAndreplacedertThat(spy, startLocatorCommand);
    ArgumentCaptor<String[]> commandLines = ArgumentCaptor.forClreplaced(String[].clreplaced);
    verify(spy).getProcess(any(), commandLines.capture());
    String[] lines = commandLines.getValue();
    replacedertThat(lines).containsOnlyOnce("--hostname-for-clients=" + FAKE_HOSTNAME);
}

19 View Complete Implementation : PutTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldSucceedIfAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    this.put.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<byte[]> argument = ArgumentCaptor.forClreplaced(byte[].clreplaced);
    verify(this.replyMessage).addBytesPart(argument.capture());
    replacedertThat(argument.getValue()).isEqualTo(OK_BYTES);
    verify(this.authzRequest).putAuthorize(eq(REGION_NAME), eq(KEY), eq(VALUE), eq(true), eq(CALLBACK_ARG));
    verify(this.replyMessage).send(this.serverConnection);
}

19 View Complete Implementation : Put65Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldSucceedIfAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    this.put65.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<byte[]> argument = ArgumentCaptor.forClreplaced(byte[].clreplaced);
    verify(this.replyMessage).addBytesPart(argument.capture());
    replacedertThat(argument.getValue()).isEqualTo(OK_BYTES);
    verify(this.authzRequest).putAuthorize(eq(REGION_NAME), eq(KEY), eq(VALUE), eq(true), eq(CALLBACK_ARG));
    verify(this.replyMessage).send(this.serverConnection);
}

19 View Complete Implementation : GetAll70Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    for (Object key : KEYS) {
        doThrow(new NotAuthorizedException("")).when(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(key.toString()), eq(null));
    }
    this.getAll70.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPartNoCopying(argument.capture());
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object o : argument.getValue().getObjects()) {
        replacedertThat(o).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    }
    for (Object key : KEYS) {
        verify(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(key.toString()), eq(null));
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : GetAll651Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void integratedSecurityShouldSucceedIfAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(true);
    this.getAll651.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPart(argument.capture(), eq(false));
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object key : argument.getValue().getKeys()) {
        replacedertThat(key).isIn(KEYS);
    }
    for (Object key : KEYS) {
        verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, key.toString());
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : RegisterInterest61Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    doThrow(new NotAuthorizedException("")).when(this.authzRequest).registerInterestAuthorize(eq(REGION_NAME), eq(KEY), anyInt(), any());
    this.registerInterest61.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    verify(this.authzRequest).registerInterestAuthorize(eq(REGION_NAME), eq(KEY), anyInt(), any());
    ArgumentCaptor<NotAuthorizedException> argument = ArgumentCaptor.forClreplaced(NotAuthorizedException.clreplaced);
    verify(this.chunkedResponseMessage).addObjPart(argument.capture());
    replacedertThat(argument.getValue()).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    verify(this.chunkedResponseMessage).sendChunk(this.serverConnection);
}

19 View Complete Implementation : MemberManagementControllerSpringTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void getMemberMappingRecognizesMemberIdWithDot() throws Exception {
    String memberIdWithDot = "member.id";
    String requestPath = URI_VERSION + MEMBER_ENDPOINT + "/" + memberIdWithDot;
    when(cms.get(any())).thenReturn(new ClusterManagementGetResult<>());
    context.perform(get(requestPath)).andExpect(status().is2xxSuccessful());
    ArgumentCaptor<Member> memberCaptor = ArgumentCaptor.forClreplaced(Member.clreplaced);
    verify(cms).get(memberCaptor.capture());
    replacedertThat(memberCaptor.getValue().getId()).isEqualTo(memberIdWithDot);
}

19 View Complete Implementation : Put65Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void noRegionNameShouldFail() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(false);
    when(this.regionNamePart.getCachedString()).thenReturn(null);
    this.put65.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<String> argument = ArgumentCaptor.forClreplaced(String.clreplaced);
    verify(this.errorResponseMessage).addStringPart(argument.capture());
    replacedertThat(argument.getValue()).contains("The input region name for the put request is null");
    verify(this.errorResponseMessage).send(this.serverConnection);
}

19 View Complete Implementation : GetAll70Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void integratedSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(true);
    for (Object key : KEYS) {
        doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, key.toString());
    }
    this.getAll70.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    for (Object key : KEYS) {
        verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, key.toString());
    }
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPartNoCopying(argument.capture());
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object key : argument.getValue().getObjects()) {
        replacedertThat(key).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}

19 View Complete Implementation : FileSystemStatsJUnitTest.java
Copyright Apache License 2.0
Author : apache
@Before
public void createStats() {
    StatisticsFactory statsFactory = mock(StatisticsFactory.clreplaced);
    statistics = mock(Statistics.clreplaced);
    when(statsFactory.createAtomicStatistics(any(), anyString())).thenReturn(statistics);
    stats = new FileSystemStats(statsFactory, "stats");
    ArgumentCaptor<StatisticsType> statsTypeCaptor = ArgumentCaptor.forClreplaced(StatisticsType.clreplaced);
    verify(statsFactory).createAtomicStatistics(statsTypeCaptor.capture(), anyString());
    type = statsTypeCaptor.getValue();
}

19 View Complete Implementation : CallbackSamplerTest.java
Copyright Apache License 2.0
Author : apache
private Runnable invokeStartAndGetTask() {
    sampler.start(executorService, statisticsManager, 1, TimeUnit.MILLISECONDS);
    ArgumentCaptor<Runnable> runnableCaptor = ArgumentCaptor.forClreplaced(Runnable.clreplaced);
    verify(executorService).scheduleAtFixedRate(runnableCaptor.capture(), eq(1L), eq(1L), eq(TimeUnit.MILLISECONDS));
    return runnableCaptor.getValue();
}

19 View Complete Implementation : StartLocatorCommandIntegrationTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void startLocatorRespectsJmxManagerHostnameForClients() throws Exception {
    String startLocatorCommand = new CommandStringBuilder("start locator").addOption(JMX_MANAGER_HOSTNAME_FOR_CLIENTS, FAKE_HOSTNAME).toString();
    commandRule.executeAndreplacedertThat(spy, startLocatorCommand);
    ArgumentCaptor<Properties> gemfirePropertiesCaptor = ArgumentCaptor.forClreplaced(Properties.clreplaced);
    verify(spy).createStartLocatorCommandLine(any(), any(), any(), gemfirePropertiesCaptor.capture(), any(), any(), any(), any(), any());
    Properties gemfireProperties = gemfirePropertiesCaptor.getValue();
    replacedertThat(gemfireProperties).containsKey(JMX_MANAGER_HOSTNAME_FOR_CLIENTS);
    replacedertThat(gemfireProperties.get(JMX_MANAGER_HOSTNAME_FOR_CLIENTS)).isEqualTo(FAKE_HOSTNAME);
}

19 View Complete Implementation : EntryEventSerializationTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void distributedNoAckRegionSetsCachedSerializedNewValue() {
    when(region.getScope()).thenReturn(Scope.DISTRIBUTED_NO_ACK);
    instance.serializeNewValueIfNeeded(region, event);
    ArgumentCaptor<byte[]> captor = ArgumentCaptor.forClreplaced(byte[].clreplaced);
    verify(event, times(1)).setCachedSerializedNewValue(captor.capture());
    replacedertThat(captor.getValue().length).isGreaterThan(0);
}

19 View Complete Implementation : Put65Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void noKeyShouldFail() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(false);
    when(this.keyPart.getStringOrObject()).thenReturn(null);
    this.put65.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<String> argument = ArgumentCaptor.forClreplaced(String.clreplaced);
    verify(this.errorResponseMessage).addStringPart(argument.capture());
    replacedertThat(argument.getValue()).contains("The input key for the put request is null");
    verify(this.errorResponseMessage).send(this.serverConnection);
}

19 View Complete Implementation : DestroyMappingCommandFunctionTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void executeReportsErrorIfMappingNotFound() {
    function.execute(context);
    ArgumentCaptor<CliFunctionResult> argument = ArgumentCaptor.forClreplaced(CliFunctionResult.clreplaced);
    verify(resultSender, times(1)).lastResult(argument.capture());
    replacedertThat(argument.getValue().getStatusMessage()).contains("JDBC mapping for region \"" + regionName + "\" not found");
}

19 View Complete Implementation : RegisterInterestList61Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    doThrow(new NotAuthorizedException("")).when(this.authzRequest).registerInterestListAuthorize(eq(REGION_NAME), any(), any());
    this.registerInterestList61.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    verify(this.authzRequest).registerInterestListAuthorize(eq(REGION_NAME), any(), any());
    ArgumentCaptor<NotAuthorizedException> argument = ArgumentCaptor.forClreplaced(NotAuthorizedException.clreplaced);
    verify(this.chunkedResponseMessage).addObjPart(argument.capture());
    replacedertThat(argument.getValue()).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    verify(this.chunkedResponseMessage).sendChunk(this.serverConnection);
}

19 View Complete Implementation : RegisterInterestListTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    doThrow(new NotAuthorizedException("")).when(this.authzRequest).registerInterestListAuthorize(eq(REGION_NAME), any(), any());
    this.registerInterestList.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    verify(this.authzRequest).registerInterestListAuthorize(eq(REGION_NAME), any(), any());
    ArgumentCaptor<NotAuthorizedException> argument = ArgumentCaptor.forClreplaced(NotAuthorizedException.clreplaced);
    verify(this.chunkedResponseMessage).addObjPart(argument.capture());
    replacedertThat(argument.getValue()).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    verify(this.chunkedResponseMessage).sendChunk(this.serverConnection);
}

19 View Complete Implementation : GetAll70Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void integratedSecurityShouldSucceedIfAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(true);
    this.getAll70.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPartNoCopying(argument.capture());
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object key : argument.getValue().getKeys()) {
        replacedertThat(key).isIn(KEYS);
    }
    for (Object key : KEYS) {
        verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, key.toString());
    }
    verify(this.chunkedResponseMessage).sendChunk(this.serverConnection);
}

19 View Complete Implementation : Put61Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void oldSecurityShouldSucceedIfAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(false);
    this.put61.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    ArgumentCaptor<byte[]> argument = ArgumentCaptor.forClreplaced(byte[].clreplaced);
    verify(this.replyMessage).addBytesPart(argument.capture());
    replacedertThat(argument.getValue()).isEqualTo(OK_BYTES);
    verify(this.authzRequest).putAuthorize(eq(REGION_NAME), eq(KEY), eq(null), eq(true), eq(CALLBACK_ARG));
    verify(this.replyMessage).send(this.serverConnection);
}

19 View Complete Implementation : EntryEventSerializationTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void newValueIsCachedDeserializableUsesItsSerializedValue() {
    CachedDeserializable newValue = mock(CachedDeserializable.clreplaced);
    when(event.basicGetNewValue()).thenReturn(newValue);
    byte[] bytes = new byte[] { 0, 3, 4 };
    when(newValue.getSerializedValue()).thenReturn(bytes);
    instance.serializeNewValueIfNeeded(region, event);
    ArgumentCaptor<byte[]> captor = ArgumentCaptor.forClreplaced(byte[].clreplaced);
    verify(event, times(1)).setCachedSerializedNewValue(captor.capture());
    replacedertThat(captor.getValue()).isEqualTo(bytes);
}

19 View Complete Implementation : StartupMessageJUnitTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void processShouldSendAReplyMessageWhenExceptionThrown() {
    ClusterDistributionManager distributionManager = mock(ClusterDistributionManager.clreplaced);
    InternalDistributedMember id = mock(InternalDistributedMember.clreplaced);
    when(distributionManager.getId()).thenReturn(id);
    // This method will throw an exception in the middle of StartupMessage.process
    when(distributionManager.getTransport()).thenThrow(new IllegalStateException("FAIL"));
    StartupMessage startupMessage = new StartupMessage();
    startupMessage.setSender(id);
    startupMessage.process(distributionManager);
    // We expect process to send a ReplyMessage with an exception
    // So that the sender is not blocked
    ArgumentCaptor<DistributionMessage> responseCaptor = ArgumentCaptor.forClreplaced(DistributionMessage.clreplaced);
    verify(distributionManager).putOutgoing(responseCaptor.capture());
    DistributionMessage response = responseCaptor.getValue();
    replacedertThat(response).isInstanceOf(ReplyMessage.clreplaced);
    replacedertThat(((ReplyMessage) response).getException()).isInstanceOf(ReplyException.clreplaced).hasCauseInstanceOf(IllegalStateException.clreplaced);
}

19 View Complete Implementation : GetAll651Test.java
Copyright Apache License 2.0
Author : apache
@Test
public void integratedSecurityShouldFailIfNotAuthorized() throws Exception {
    when(this.securityService.isClientSecurityRequired()).thenReturn(true);
    when(this.securityService.isIntegratedSecurity()).thenReturn(true);
    for (Object key : KEYS) {
        doThrow(new NotAuthorizedException("")).when(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, key.toString());
    }
    this.getAll651.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
    for (Object key : KEYS) {
        verify(this.securityService).authorize(Resource.DATA, Operation.READ, REGION_NAME, key.toString());
    }
    ArgumentCaptor<ObjectPartList> argument = ArgumentCaptor.forClreplaced(ObjectPartList.clreplaced);
    verify(this.chunkedResponseMessage).addObjPart(argument.capture(), eq(false));
    replacedertThat(argument.getValue().getObjects()).hreplacedize(KEYS.length);
    for (Object key : argument.getValue().getObjects()) {
        replacedertThat(key).isExactlyInstanceOf(NotAuthorizedException.clreplaced);
    }
    verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
}