public static String getMailingListAddress(
      long groupId, long categoryId, long messageId, String mx, String defaultMailingListAddress) {

    if (PropsValues.POP_SERVER_SUBDOMAIN.length() <= 0) {
      String mailingListAddress = defaultMailingListAddress;

      try {
        MBMailingList mailingList =
            MBMailingListLocalServiceUtil.getCategoryMailingList(groupId, categoryId);

        if (mailingList.isActive()) {
          mailingListAddress = mailingList.getEmailAddress();
        }
      } catch (Exception e) {
      }

      return mailingListAddress;
    }

    StringBundler sb = new StringBundler(8);

    sb.append(MESSAGE_POP_PORTLET_PREFIX);
    sb.append(categoryId);
    sb.append(StringPool.PERIOD);
    sb.append(messageId);
    sb.append(StringPool.AT);
    sb.append(PropsValues.POP_SERVER_SUBDOMAIN);
    sb.append(StringPool.PERIOD);
    sb.append(mx);

    return sb.toString();
  }
  @Test
  public void testActionableDynamicQuery() throws Exception {
    final IntegerWrapper count = new IntegerWrapper();

    ActionableDynamicQuery actionableDynamicQuery =
        MBMailingListLocalServiceUtil.getActionableDynamicQuery();

    actionableDynamicQuery.setPerformActionMethod(
        new ActionableDynamicQuery.PerformActionMethod() {
          @Override
          public void performAction(Object object) {
            MBMailingList mbMailingList = (MBMailingList) object;

            Assert.assertNotNull(mbMailingList);

            count.increment();
          }
        });

    actionableDynamicQuery.performActions();

    Assert.assertEquals(count.getValue(), _persistence.countAll());
  }