BucketStatsRetriever { public String retrieveBucketStats(ClientParameters.SelectionType type, String id, BucketId bucketId, String bucketSpace) throws BucketStatsException { String documentSelection = createDocumentSelection(type, id); StatBucketMessage msg = new StatBucketMessage(bucketId, bucketSpace, documentSelection); StatBucketReply statBucketReply = sendMessage(msg, StatBucketReply.class); return statBucketReply.getResults(); } BucketStatsRetriever(
            DocumentAccessFactory documentAccessFactory,
            String route,
            ShutdownHookRegistrar registrar); BucketId getBucketIdForType(ClientParameters.SelectionType type, String id); String retrieveBucketStats(ClientParameters.SelectionType type, String id, BucketId bucketId, String bucketSpace); List<GetBucketListReply.BucketInfo> retrieveBucketList(BucketId bucketId, String bucketSpace);  }
@Test public void testRetrieveBucketStats() throws BucketStatsException { String docId = "id:ns:type::another"; String bucketInfo = "I like turtles!"; BucketId bucketId = bucketIdFactory.getBucketId(new DocumentId(docId)); StatBucketReply reply = new StatBucketReply(); reply.setResults(bucketInfo); when(mockedSession.syncSend(any())).thenReturn(reply); String result = createRetriever().retrieveBucketStats(ClientParameters.SelectionType.DOCUMENT, docId, bucketId, bucketSpace); verify(mockedSession, times(1)).syncSend(any()); assertEquals(bucketInfo, result); }