### Question:
PostMessage extends ProcessMessage { public boolean routeSms(Message message) { Logger.log(TAG, "routeSms uuid: " + message.toString()); if (!mPrefsFactory.serviceEnabled().get()) { return false; } if (mPrefsFactory.enableReply().get()) { logActivities(R.string.auto_response_sent); Message msg = new Message(); msg.setMessageBody(mPrefsFactory.reply().get()); msg.setMessageFrom(message.getMessageFrom()); msg.setMessageType(message.getMessageType()); mProcessSms.sendSms(map(msg), false); } if (isConnected()) { List<SyncUrl> syncUrlList = mWebServiceDataSource .get(SyncUrl.Status.ENABLED); List<Filter> filters = mFilterDataSource.getFilters(); for (SyncUrl syncUrl : syncUrlList) { if (mPrefsFactory.enableWhitelist().get()) { for (Filter filter : filters) { if ((filter.getPhoneNumber().equals(message.getMessageFrom())) && (filter .getStatus().equals(Filter.Status.WHITELIST))) { if (postMessage(message, syncUrl)) { postToSentBox(message); deleteFromSmsInbox(message); } else { savePendingMessage(message); } } } } if (mPrefsFactory.enableBlacklist().get()) { for (Filter filter : filters) { if ((filter.getPhoneNumber().equals(message.getMessageFrom())) && (!filter .getStatus().equals(Filter.Status.BLACKLIST))) { if (postMessage(message, syncUrl)) { postToSentBox(message); deleteFromSmsInbox(message); } else { savePendingMessage(message); } } } } if ((!mPrefsFactory.enableBlacklist().get()) && (!mPrefsFactory.enableWhitelist() .get())) { if (postMessage(message, syncUrl)) { postToSentBox(message); deleteFromSmsInbox(message); } else { savePendingMessage(message); } } } return true; } savePendingMessage(message); return false; } @Inject  PostMessage(Context context, PrefsFactory prefsFactory,
            MessageHttpClient messageHttpClient,
            MessageDataSource messageDataSource,
            WebServiceDataSource webServiceDataSource,
            FilterDataSource filterDataSource,
            ProcessSms processSms,
            FileManager fileManager,
            ProcessMessageResult processMessageResult); boolean routeSms(Message message); boolean syncPendingMessages(); boolean postMessage(List<Message> messages); boolean routePendingMessage(Message message); void performTask(); String getErrorMessage(); boolean isConnected(); String getPhoneNumber();  }### Answer:
@Test public void shouldSendMessageWhenWhitelistIsEnabledAndBlacklistIsDisabled() { List<SyncUrl> syncUrls = Arrays.asList(mMockSyncUrl); stubNeedMethodsRouteSms(syncUrls, true, false, true, SyncUrl.Status.ENABLED, false, false, false, false); mPostMessage.routeSms(mMockMessage); verify(mMockWebServiceDataSource).get(SyncUrl.Status.ENABLED); verify(mMockMessageHttpClient, times(1)) .postSmsToWebService(syncUrls.get(0), mMockMessage, FROM, DEVICE_ID); }