### Question:
MessageHandler { @Operation(httpMethods = "GET") public Future<?> get(SocialRequestItem request) throws ProtocolException { Set<UserId> userIds = request.getUsers(); String msgCollId = request.getParameter("msgCollId"); List<String> messageIds = request.getListParameter("messageIds"); CollectionOptions options = collectionOptionsFactory.create(request); HandlerPreconditions.requireNotEmpty(userIds, "No userId specified"); HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported"); UserId user = request.getUsers().iterator().next(); if (msgCollId == null) { Set<String> fields = request.getFields(MessageCollection.Field.ALL_FIELDS); return service.getMessageCollections(user, fields, options, request.getToken()); } Set<String> fields = request.getFields(Message.Field.ALL_FIELDS); return service.getMessages(user, msgCollId, fields, messageIds, options, request.getToken()); } @Inject  MessageHandler(MessageService service, CollectionOptionsFactory collectionOptionsFactory); @Operation(httpMethods = "DELETE") Future<?> delete(SocialRequestItem request); @Operation(httpMethods = "GET") Future<?> get(SocialRequestItem request); @Operation(httpMethods = "POST", bodyParam = "entity") Future<?> create(SocialRequestItem request); @Operation(httpMethods = "PUT", bodyParam = "entity") Future<?> modify(SocialRequestItem request);  }### Answer:
@Test @Ignore public void testPostMessage() throws Exception { MessageImpl message = new MessageImpl("A message body", "A title", Message.Type.PRIVATE_MESSAGE); message.setRecipients(recipients); EasyMock.expect(converter.convertToObject(null, Message.class)).andReturn(message); EasyMock.expect(messageService.createMessage(sender, "messageHandlerTest", "@outbox", message, token)).andReturn(Futures.immediateFuture((Void) null)); EasyMock.replay(messageService, converter); RestHandler operation = registry.getRestHandler("/messages/" + sender.getUserId() + "/@outbox", "POST"); Map<String,String[]> params = ImmutableMap.of(RequestItem.APP_ID, new String[]{"messageHandlerTest"}); operation.execute(params,null, token, converter).get(); EasyMock.verify(converter, messageService); }