/**
   * The main logic or behavior to test using Mockito
   *
   * @param record
   */
  public void process(PersonRecord record) {
    if (record.getId() == null || record.getStatus() == null) {
      return;
    }

    if (record.getStatus().equalsIgnoreCase("UNDERAGED")) {
      service.processUnderAged(record);
    } else {
      service.processLegalAged(record);
    }
  }
  public ContentValues messageToContentValues(final Message message)
      throws IOException, MessagingException {
    if (message == null) throw new MessagingException("message is null");

    final ContentValues values = new ContentValues();
    switch (getDataType(message)) {
      case SMS:
        if (message.getBody() == null) throw new MessagingException("body is null");

        InputStream is = message.getBody().getInputStream();
        if (is == null) {
          throw new MessagingException("body.getInputStream() is null for " + message.getBody());
        }
        final String body = IOUtils.toString(is);
        final String address = Headers.get(message, Headers.ADDRESS);
        values.put(SmsConsts.BODY, body);
        values.put(SmsConsts.ADDRESS, address);
        values.put(SmsConsts.TYPE, Headers.get(message, Headers.TYPE));
        values.put(SmsConsts.PROTOCOL, Headers.get(message, Headers.PROTOCOL));
        values.put(SmsConsts.SERVICE_CENTER, Headers.get(message, Headers.SERVICE_CENTER));
        values.put(SmsConsts.DATE, Headers.get(message, Headers.DATE));
        values.put(SmsConsts.STATUS, Headers.get(message, Headers.STATUS));
        values.put(SmsConsts.THREAD_ID, threadHelper.getThreadId(mContext, address));
        values.put(SmsConsts.READ, mMarkAsReadOnRestore ? "1" : Headers.get(message, Headers.READ));
        break;
      case CALLLOG:
        values.put(CallLog.Calls.NUMBER, Headers.get(message, Headers.ADDRESS));
        values.put(CallLog.Calls.TYPE, Integer.valueOf(Headers.get(message, Headers.TYPE)));
        values.put(CallLog.Calls.DATE, Headers.get(message, Headers.DATE));
        values.put(CallLog.Calls.DURATION, Long.valueOf(Headers.get(message, Headers.DURATION)));
        values.put(CallLog.Calls.NEW, 0);

        PersonRecord record = mPersonLookup.lookupPerson(Headers.get(message, Headers.ADDRESS));
        if (!record.isUnknown()) {
          values.put(CallLog.Calls.CACHED_NAME, record.getName());
          values.put(CallLog.Calls.CACHED_NUMBER_TYPE, -2);
        }

        break;
      default:
        throw new MessagingException("don't know how to restore " + getDataType(message));
    }

    return values;
  }