Java Code Examples for scala.concurrent.Promise#success()

The following examples show how to use scala.concurrent.Promise#success() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrganisationMetricsActorTest.java    From sunbird-lms-service with MIT License 6 votes vote down vote up
@SuppressWarnings({"deprecation", "unchecked"})
@Test
public void testOrgConsumptionMetricsReportDataSuccess() {
  TestKit probe = new TestKit(system);
  ActorRef subject = system.actorOf(prop);
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(userOrgMap);
  when(esService.getDataByIdentifier(Mockito.anyString(), Mockito.anyString()))
      .thenReturn(promise.future());

  Request actorMessage = new Request();
  actorMessage.put(JsonKey.ORG_ID, orgId);
  actorMessage.put(JsonKey.PERIOD, "7d");
  actorMessage.put(JsonKey.REQUESTED_BY, userId);
  actorMessage.put(JsonKey.FORMAT, "csv");
  actorMessage.setOperation(ActorOperations.ORG_CONSUMPTION_METRICS_REPORT.getValue());

  subject.tell(actorMessage, probe.getRef());
  Response res = probe.expectMsgClass(duration("10 second"), Response.class);
  Map<String, Object> data = res.getResult();
  String id = (String) data.get(JsonKey.REQUEST_ID);
  Assert.assertNotNull(id);
}
 
Example 2
Source File: NotesManagementActorTest.java    From sunbird-lms-service with MIT License 6 votes vote down vote up
@Test
public void testDeleteNoteSuccess() {
  Request req = new Request();
  req.getContext().put(JsonKey.REQUESTED_BY, userId);
  req.getContext().put(JsonKey.NOTE_ID, noteId);
  Map<String, Object> reqMap = new HashMap<>();
  reqMap.put(JsonKey.USER_ID, userId);
  req.setRequest(reqMap);
  req.setOperation(ActorOperations.DELETE_NOTE.getValue());
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(reqMap);
  when(esUtil.getDataByIdentifier(Mockito.anyString(), Mockito.anyString()))
      .thenReturn(promise.future())
      .thenReturn(promise.future());
  when(cassandraOperation.updateRecord(
          Mockito.anyString(), Mockito.anyString(), Mockito.anyMap()))
      .thenReturn(getSuccessResponse());
  boolean result = testScenario(req, null);
  assertTrue(result);
}
 
Example 3
Source File: OrganisationMetricsActorTest.java    From sunbird-lms-service with MIT License 6 votes vote down vote up
@Before
public void before() {
  PowerMockito.mockStatic(HttpClientBuilder.class);
  PowerMockito.mockStatic(ServiceFactory.class);
  PowerMockito.mockStatic(EsClientFactory.class);
  cassandraOperation = mock(CassandraOperationImpl.class);
  esService = mock(ElasticSearchRestHighImpl.class);
  when(EsClientFactory.getInstance(Mockito.anyString())).thenReturn(esService);
  when(ServiceFactory.getInstance()).thenReturn(cassandraOperation);
  Response response = createCassandraInsertSuccessResponse();
  when(cassandraOperation.insertRecord(
          Mockito.anyString(), Mockito.anyString(), Mockito.anyMap()))
      .thenReturn(response);
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(userOrgMap);
  when(esService.getDataByIdentifier(Mockito.anyString(), Mockito.anyString()))
      .thenReturn(promise.future());
}
 
Example 4
Source File: OrganisationMetricsActorTest.java    From sunbird-lms-service with MIT License 6 votes vote down vote up
@SuppressWarnings("deprecation")
@Test
public void testOrgConsumptionMetricsWithInvalidOrgId() {
  TestKit probe = new TestKit(system);
  ActorRef subject = system.actorOf(prop);
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(null);
  when(esService.getDataByIdentifier(Mockito.anyString(), Mockito.anyString()))
      .thenReturn(promise.future());

  Request actorMessage = new Request();
  actorMessage.put(JsonKey.ORG_ID, "ORG_001_INVALID");
  actorMessage.put(JsonKey.PERIOD, "7d");
  actorMessage.setOperation(ActorOperations.ORG_CONSUMPTION_METRICS.getValue());

  subject.tell(actorMessage, probe.getRef());
  ProjectCommonException e =
      probe.expectMsgClass(duration("10 second"), ProjectCommonException.class);
  Assert.assertEquals(ResponseCode.invalidOrgData.getErrorCode(), e.getCode());
}
 
Example 5
Source File: NotesManagementActorTest.java    From sunbird-lms-service with MIT License 6 votes vote down vote up
@Test
public void testGetNoteFailurewithUserIdMismatch() {
  Request req = new Request();
  req.getContext().put(JsonKey.REQUESTED_BY, userId);
  req.getContext().put(JsonKey.NOTE_ID, noteId);
  Map<String, Object> reqMap = new HashMap<>();
  reqMap.put(JsonKey.USER_ID, "misMatch");
  req.setRequest(reqMap);
  req.setOperation(ActorOperations.GET_NOTE.getValue());
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(reqMap);

  when(esUtil.getDataByIdentifier(Mockito.anyString(), Mockito.anyString()))
      .thenReturn(promise.future());
  boolean result = testScenario(req, ResponseCode.errorForbidden);
  assertTrue(result);
}
 
Example 6
Source File: SearchHandlerActorTest.java    From sunbird-lms-service with MIT License 6 votes vote down vote up
@Before
public void beforeTest() {
  PowerMockito.mockStatic(EsClientFactory.class);
  esService = mock(ElasticSearchRestHighImpl.class);
  when(EsClientFactory.getInstance(Mockito.anyString())).thenReturn(esService);
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(createResponseGet(true));
  when(esService.search(Mockito.any(SearchDTO.class), Mockito.anyVararg()))
      .thenReturn(promise.future());

  PowerMockito.mockStatic(ServiceFactory.class);
  when(ServiceFactory.getInstance()).thenReturn(cassandraOperation);
  when(cassandraOperation.getRecordsByProperties(
          Mockito.anyString(), Mockito.anyString(), Mockito.anyMap(), Mockito.anyList()))
      .thenReturn(getRecordByPropertyResponse());
}
 
Example 7
Source File: UserAssignRoleTest.java    From sunbird-lms-service with MIT License 6 votes vote down vote up
@Before
public void mockClasses() throws Exception {

  PowerMockito.mockStatic(ServiceFactory.class);
  PowerMockito.mockStatic(EsClientFactory.class);
  cassandraOperation = PowerMockito.mock(CassandraOperationImpl.class);
  PowerMockito.when(ServiceFactory.getInstance()).thenReturn(cassandraOperation);
  esService = PowerMockito.mock(ElasticSearchRestHighImpl.class);
  PowerMockito.when(EsClientFactory.getInstance(Mockito.anyString())).thenReturn(esService);
  Map<String, Object> roleMap = new HashMap<>();
  for (String role : ALL_ROLES) roleMap.put(role, role);
  PowerMockito.mockStatic(DataCacheHandler.class);
  PowerMockito.when(DataCacheHandler.getRoleMap()).thenReturn(roleMap);
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(userOrg);
  Promise<Map<String, Object>> promise_es = Futures.promise();
  promise_es.success(esRespone);
  PowerMockito.when(esService.getDataByIdentifier(Mockito.any(), Mockito.any()))
      .thenReturn(promise.future());
  PowerMockito.when(esService.search(Mockito.any(), Mockito.any()))
      .thenReturn(promise_es.future());
}
 
Example 8
Source File: OrganisationMetricsActorTest.java    From sunbird-lms-service with MIT License 6 votes vote down vote up
@SuppressWarnings("deprecation")
@Test
public void testOrgCreationMetricsWithInvalidOrgId() {
  TestKit probe = new TestKit(system);
  ActorRef subject = system.actorOf(prop);
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(null);
  when(esService.getDataByIdentifier(Mockito.anyString(), Mockito.anyString()))
      .thenReturn(promise.future());

  Request actorMessage = new Request();
  actorMessage.put(JsonKey.ORG_ID, "ORG_001_INVALID");
  actorMessage.put(JsonKey.PERIOD, "7d");
  actorMessage.setOperation(ActorOperations.ORG_CREATION_METRICS.getValue());

  subject.tell(actorMessage, probe.getRef());
  ProjectCommonException e =
      probe.expectMsgClass(duration("10 second"), ProjectCommonException.class);
  Assert.assertEquals(ResponseCode.invalidOrgData.getErrorCode(), e.getCode());
}
 
Example 9
Source File: UserSkillManagementActorTest.java    From sunbird-lms-service with MIT License 6 votes vote down vote up
private void mockGetSkillResponse(String userId) {
  Map<String, Object> esDtoMap = new HashMap<>();
  Map<String, Object> filters = new HashMap<>();
  filters.put(JsonKey.USER_ID, userId);
  esDtoMap.put(JsonKey.FILTERS, filters);
  List<String> fields = new ArrayList<>();
  fields.add(JsonKey.SKILLS);
  esDtoMap.put(JsonKey.FIELDS, fields);
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(createGetSkillResponse());
  when(esService.search(
          Mockito.eq(ElasticSearchHelper.createSearchDTO(esDtoMap)),
          Mockito.eq(ProjectUtil.EsType.user.getTypeName())))
      .thenReturn(promise.future());
  Promise<Map<String, Object>> promise_esDtoMap = Futures.promise();
  promise_esDtoMap.success(esDtoMap);

  when(esService.getDataByIdentifier(
          Mockito.eq(ProjectUtil.EsType.user.getTypeName()), Mockito.eq(userId)))
      .thenReturn(promise_esDtoMap.future());
  when(ElasticSearchHelper.getResponseFromFuture(promise_esDtoMap.future())).thenReturn(esDtoMap);
  when(ElasticSearchHelper.getResponseFromFuture(promise.future()))
      .thenReturn(createGetSkillResponse());
}
 
Example 10
Source File: NotesManagementActorTest.java    From sunbird-lms-service with MIT License 6 votes vote down vote up
@Test
public void testUpdateNoteFailurewithEmptyNote() {
  Request req = new Request();
  req.getContext().put(JsonKey.REQUESTED_BY, userId);
  req.getContext().put(JsonKey.NOTE_ID, noteId);
  Map<String, Object> reqMap = new HashMap<>();
  reqMap.put(JsonKey.USER_ID, userId);
  req.setRequest(reqMap);
  req.setOperation(ActorOperations.UPDATE_NOTE.getValue());
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(reqMap);
  Promise<Map<String, Object>> promiseAny = Futures.promise();
  promiseAny.success(new HashMap<>());
  when(esUtil.getDataByIdentifier(Mockito.anyString(), Mockito.anyString()))
      .thenReturn(promise.future())
      .thenReturn(promiseAny.future());
  boolean result = testScenario(req, ResponseCode.invalidNoteId);
  assertTrue(result);
}
 
Example 11
Source File: OrganisationMetricsActorTest.java    From sunbird-lms-service with MIT License 6 votes vote down vote up
@SuppressWarnings({"deprecation", "unchecked"})
@Test
public void testOrgCreationMetricsReportDataSuccess() {
  TestKit probe = new TestKit(system);
  ActorRef subject = system.actorOf(prop);

  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(userOrgMap);
  when(esService.getDataByIdentifier(Mockito.anyString(), Mockito.anyString()))
      .thenReturn(promise.future());

  Request actorMessage = new Request();
  actorMessage.put(JsonKey.ORG_ID, orgId);
  actorMessage.put(JsonKey.PERIOD, "7d");
  actorMessage.put(JsonKey.REQUESTED_BY, userId);
  actorMessage.put(JsonKey.FORMAT, "csv");
  actorMessage.setOperation(ActorOperations.ORG_CREATION_METRICS_REPORT.getValue());

  subject.tell(actorMessage, probe.getRef());
  Response res = probe.expectMsgClass(duration("10 second"), Response.class);
  Map<String, Object> data = res.getResult();
  String id = (String) data.get(JsonKey.REQUEST_ID);
  Assert.assertNotNull(id);
}
 
Example 12
Source File: OrgManagementActorTest.java    From sunbird-lms-service with MIT License 6 votes vote down vote up
@Test
public void testCreateOrgSuccessWithExternalIdAndProvider() {
  when(cassandraOperation.getRecordsByCompositeKey(
          Mockito.anyString(), Mockito.anyString(), Mockito.anyMap()))
      .thenReturn(getRecordsByProperty(true));
  when(cassandraOperation.insertRecord(
          Mockito.anyString(), Mockito.anyString(), Mockito.anyMap()))
      .thenReturn(getSuccess());
  when(cassandraOperation.getRecordsByProperties(
          Mockito.anyString(), Mockito.anyString(), Mockito.anyMap()))
      .thenReturn(getRecordsByProperty(true));
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(getValidateChannelEsResponse(true));

  when(esService.search(Mockito.any(), Mockito.anyString())).thenReturn(promise.future());
  boolean result =
      testScenario(
          getRequest(
              getRequestDataForOrgCreate(basicRequestData),
              ActorOperations.CREATE_ORG.getValue()),
          null);
  assertTrue(result);
}
 
Example 13
Source File: NotesManagementActorTest.java    From sunbird-lms-service with MIT License 5 votes vote down vote up
@Test
public void testCreateNoteFailureWithInvalidUserId() {
  Request req = new Request();
  Map<String, Object> reqMap = new HashMap<>();
  req.setRequest(reqMap);
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(new HashMap<>());
  when(esUtil.getDataByIdentifier(Mockito.anyString(), Mockito.anyString()))
      .thenReturn(promise.future());
  req.setOperation(ActorOperations.CREATE_NOTE.getValue());
  boolean result = testScenario(req, ResponseCode.invalidUserId);
  assertTrue(result);
}
 
Example 14
Source File: UserManagementActorTest.java    From sunbird-lms-service with MIT License 5 votes vote down vote up
@Test
public void testCreateUserFailureWithInvalidOrg() {
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(null);
  when(esService.getDataByIdentifier(Mockito.anyString(), Mockito.anyString()))
      .thenReturn(promise.future());
  boolean result =
      testScenario(
          getRequest(
              false, false, false, getAdditionalMapData(reqMap), ActorOperations.CREATE_USER),
          ResponseCode.invalidOrgData);
  assertTrue(result);
}
 
Example 15
Source File: ScalaFutureBenchmark.java    From future with Apache License 2.0 5 votes vote down vote up
@Benchmark
public String mapPromise() throws Exception {
  Promise<String> p = Promise.<String>apply();
  Future<String> f = p.future().map(mapF, ec);
  p.success(string);
  return Await.result(f, inf);
}
 
Example 16
Source File: NotesManagementActorTest.java    From sunbird-lms-service with MIT License 5 votes vote down vote up
@Test
public void testSearchNoteSuccess() {
  Request req = new Request();
  req.getContext().put(JsonKey.REQUESTED_BY, userId);
  req.getContext().put(JsonKey.NOTE_ID, noteId);
  Map<String, Object> reqMap = new HashMap<>();
  req.setRequest(reqMap);
  req.setOperation(ActorOperations.SEARCH_NOTE.getValue());
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(reqMap);
  when(esUtil.search(Mockito.any(), Mockito.anyString())).thenReturn(promise.future());
  boolean result = testScenario(req, null);
  assertTrue(result);
}
 
Example 17
Source File: OrganisationMetricsActorTest.java    From sunbird-lms-service with MIT License 5 votes vote down vote up
@SuppressWarnings({"deprecation", "unchecked"})
@Test
public void testOrgCreationMetricsSuccess() throws JsonProcessingException {
  TestKit probe = new TestKit(system);
  ActorRef subject = system.actorOf(prop);
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(userOrgMap);
  when(esService.getDataByIdentifier(Mockito.anyString(), Mockito.anyString()))
      .thenReturn(promise.future());
  mockHttpPostSuccess(
      HTTP_POST,
      new ByteArrayInputStream((mapper.writeValueAsString(orgCreationSuccessMap())).getBytes()));

  Request actorMessage = new Request();
  actorMessage.put(JsonKey.ORG_ID, orgId);
  actorMessage.put(JsonKey.PERIOD, "7d");
  actorMessage.setOperation(ActorOperations.ORG_CREATION_METRICS.getValue());

  subject.tell(actorMessage, probe.getRef());
  Response res = probe.expectMsgClass(duration("50 second"), Response.class);
  Map<String, Object> data = res.getResult();
  Assert.assertEquals("7d", data.get(JsonKey.PERIOD));
  Assert.assertEquals(orgId, ((Map<String, Object>) data.get("org")).get(JsonKey.ORG_ID));
  Map<String, Object> series = (Map<String, Object>) data.get(JsonKey.SERIES);
  Assert.assertTrue(series.containsKey("org.creation.content[@status=draft].count"));
  Assert.assertTrue(series.containsKey("org.creation.content[@status=review].count"));
  Assert.assertTrue(series.containsKey("org.creation.content[@status=published].count"));
  List<Map<String, Object>> buckets =
      (List<Map<String, Object>>)
          ((Map<String, Object>) series.get("org.creation.content[@status=draft].count"))
              .get("buckets");
  Assert.assertEquals(7, buckets.size());
  Map<String, Object> snapshot = (Map<String, Object>) data.get(JsonKey.SNAPSHOT);
  Assert.assertTrue(snapshot.containsKey("org.creation.content.count"));
  Assert.assertTrue(snapshot.containsKey("org.creation.authors.count"));
  Assert.assertTrue(snapshot.containsKey("org.creation.reviewers.count"));
  Assert.assertTrue(snapshot.containsKey("org.creation.content[@status=draft].count"));
  Assert.assertTrue(snapshot.containsKey("org.creation.content[@status=review].count"));
  Assert.assertTrue(snapshot.containsKey("org.creation.content[@status=published].count"));
}
 
Example 18
Source File: EmailServiceActorTest.java    From sunbird-lms-service with MIT License 4 votes vote down vote up
@Before
public void beforeTest() {

  PowerMockito.mockStatic(ServiceFactory.class);
  PowerMockito.mockStatic(ElasticSearchHelper.class);
  esService = mock(ElasticSearchRestHighImpl.class);
  PowerMockito.mockStatic(EsClientFactory.class);
  when(EsClientFactory.getInstance(Mockito.anyString())).thenReturn(esService);
  PowerMockito.mockStatic(org.sunbird.common.models.util.datasecurity.impl.ServiceFactory.class);
  PowerMockito.mockStatic(EmailTemplateDaoImpl.class);
  when(ServiceFactory.getInstance()).thenReturn(cassandraOperation);
  when(org.sunbird.common.models.util.datasecurity.impl.ServiceFactory
          .getDecryptionServiceInstance(null))
      .thenReturn(defaultDecryptionService);
  when(org.sunbird.common.models.util.datasecurity.impl.ServiceFactory
          .getEncryptionServiceInstance(null))
      .thenReturn(defaultEncryptionServivce);
  when(cassandraOperation.getRecordsByIdsWithSpecifiedColumns(
          Mockito.anyString(), Mockito.anyString(), Mockito.anyList(), Mockito.anyList()))
      .thenReturn(cassandraGetRecordById());

  emailTemplateDao = mock(EmailTemplateDaoImpl.class);
  when(EmailTemplateDaoImpl.getInstance()).thenReturn(emailTemplateDao);
  when(emailTemplateDao.getTemplate(Mockito.anyString())).thenReturn("templateName");

  Map<String, Object> recipientSearchQuery = new HashMap<>();
  recipientSearchQuery.put(JsonKey.FILTERS, "anyName");
  recipientSearchQuery.put(JsonKey.ROOT_ORG_ID, "anyRootId");
  Map<String, Object> esOrgResult = new HashMap<>();
  esOrgResult.put(JsonKey.ORGANISATION_NAME, "anyOrgName");
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(createGetSkillResponse());
  when(esService.search(
          Mockito.eq(ElasticSearchHelper.createSearchDTO(recipientSearchQuery)),
          Mockito.eq(ProjectUtil.EsType.user.getTypeName())))
      .thenReturn(promise.future());
  Promise<Map<String, Object>> promise_recipientSearchQuery = Futures.promise();

  promise_recipientSearchQuery.trySuccess(recipientSearchQuery);
  when(esService.getDataByIdentifier(
          Mockito.eq(ProjectUtil.EsType.user.getTypeName()), Mockito.eq("001")))
      .thenReturn(promise_recipientSearchQuery.future());

  Promise<Map<String, Object>> promise_esOrgResult = Futures.promise();
  promise_esOrgResult.trySuccess(esOrgResult);
  when(esService.getDataByIdentifier(
          Mockito.eq(ProjectUtil.EsType.organisation.getTypeName()), Mockito.eq("anyRootId")))
      .thenReturn(promise_esOrgResult.future());
}
 
Example 19
Source File: ElasticSearchRestHighImpl.java    From sunbird-lms-service with MIT License 4 votes vote down vote up
/**
 * This method will update data entry inside Elastic search, using identifier and provided data .
 *
 * @param index String ES index name
 * @param identifier ES column identifier as an String
 * @param data Map<String,Object>
 * @return true or false
 */
@Override
public Future<Boolean> update(String index, String identifier, Map<String, Object> data) {
  long startTime = System.currentTimeMillis();
  ProjectLogger.log(
      "ElasticSearchRestHighImpl:update: method started at =="
          + startTime
          + " for Index "
          + index,
      LoggerEnum.PERF_LOG.name());
  Promise<Boolean> promise = Futures.promise();
  ;

  if (!StringUtils.isBlank(index) && !StringUtils.isBlank(identifier) && data != null) {
    UpdateRequest updateRequest = new UpdateRequest(index, _DOC, identifier).doc(data);

    ActionListener<UpdateResponse> listener =
        new ActionListener<UpdateResponse>() {
          @Override
          public void onResponse(UpdateResponse updateResponse) {
            promise.success(true);
            ProjectLogger.log(
                "ElasticSearchRestHighImpl:update:  Success with "
                    + updateResponse.getResult()
                    + " response from elastic search for index"
                    + index
                    + ",identifier : "
                    + identifier,
                LoggerEnum.INFO.name());
            ProjectLogger.log(
                "ElasticSearchRestHighImpl:update: method end =="
                    + " for INdex "
                    + index
                    + " ,Total time elapsed = "
                    + calculateEndTime(startTime),
                LoggerEnum.PERF_LOG.name());
          }

          @Override
          public void onFailure(Exception e) {
            ProjectLogger.log(
                "ElasticSearchRestHighImpl:update: exception occured:" + e.getMessage(),
                LoggerEnum.ERROR.name());
            promise.failure(e);
          }
        };
    ConnectionManager.getRestClient().updateAsync(updateRequest, listener);

  } else {
    ProjectLogger.log(
        "ElasticSearchRestHighImpl:update: Requested data is invalid.", LoggerEnum.INFO.name());
    promise.failure(ProjectUtil.createClientException(ResponseCode.invalidData));
  }
  return promise.future();
}
 
Example 20
Source File: EmailServiceActorTest.java    From sunbird-lms-service with MIT License 4 votes vote down vote up
@Test
public void testSendEmailFailureWithEmailSizeExceeding() {

  TestKit probe = new TestKit(system);
  ActorRef subject = system.actorOf(props);
  Request reqObj = new Request();
  reqObj.setOperation(BackgroundOperations.emailService.name());

  HashMap<String, Object> innerMap = new HashMap<>();
  Map<String, Object> pageMap = new HashMap<String, Object>();
  List<String> emailIdList = new ArrayList<>();

  for (int i = 0; i < 40; i++) {
    emailIdList.add("aaa" + i + "@gmail.com");
    emailIdList.add("bbb" + i + "@gmail.com");
    emailIdList.add("ccc" + i + "@gmail.com");
  }
  List<String> userIdList = new ArrayList<>();
  userIdList.add("001");
  Map<String, Object> queryMap = new HashMap<>();
  Map<String, Object> filterMap = new HashMap<>();
  filterMap.put(JsonKey.NAME, "anyName");
  queryMap.put(JsonKey.FILTERS, filterMap);
  pageMap.put(JsonKey.RECIPIENT_EMAILS, emailIdList);
  pageMap.put(JsonKey.RECIPIENT_SEARCH_QUERY, queryMap);
  innerMap.put(JsonKey.EMAIL_REQUEST, pageMap);
  innerMap.put(JsonKey.RECIPIENT_USERIDS, userIdList);
  innerMap.put(JsonKey.RECIPIENT_SEARCH_QUERY, queryMap);
  reqObj.setRequest(innerMap);
  Promise<Map<String, Object>> promise = Futures.promise();
  promise.success(createGetSkillResponse());

  when(esService.search(
          Mockito.eq(ElasticSearchHelper.createSearchDTO(new HashMap<>())),
          Mockito.eq(ProjectUtil.EsType.user.getTypeName())))
      .thenReturn(promise.future());

  subject.tell(reqObj, probe.getRef());
  ProjectCommonException exc =
      probe.expectMsgClass(duration("10 second"), ProjectCommonException.class);
  assertTrue(
      exc.getCode().equals(ResponseCode.emailNotSentRecipientsExceededMaxLimit.getErrorCode()));
}