@Override
  protected void setUp() throws Exception {
    super.setUp();
    TestSuite.initializeWithData(this);
    iteration = (iteration >= 4 ? 1 : iteration + 1);
    switch (iteration) {
      case 2:
        showAttachedImages = showAttachedImagesOld;
        showAvatars = !showAvatarsOld;
        break;
      case 3:
        showAttachedImages = !showAttachedImagesOld;
        showAvatars = showAvatarsOld;
        break;
      case 4:
        showAttachedImages = !showAttachedImagesOld;
        showAvatars = !showAvatarsOld;
        break;
      default:
        showAttachedImagesOld = MyPreferences.showAttachedImages();
        showAvatarsOld = MyPreferences.showAvatars();
        showAttachedImages = showAttachedImagesOld;
        showAvatars = showAvatarsOld;
        break;
    }
    setPreferences();
    MyLog.setLogToFile(true);
    logStartStop("setUp started");

    MyAccount ma =
        MyContextHolder.get()
            .persistentAccounts()
            .fromAccountName(TestSuite.CONVERSATION_ACCOUNT_NAME);
    assertTrue(ma.isValid());
    MyContextHolder.get().persistentAccounts().setCurrentAccount(ma);

    Intent intent =
        new Intent(
            Intent.ACTION_VIEW,
            MatchedUri.getTimelineUri(ma.getUserId(), TimelineType.HOME, false, 0));
    setActivityIntent(intent);

    activity = getActivity();

    assertTrue("MyService is available", MyServiceManager.isServiceAvailable());
    logStartStop("setUp ended");
  }
  private void notify(TimelineType timelineType, int messageTitleResId, String messageText) {
    String ringtone = MyPreferences.getString(MyPreferences.KEY_RINGTONE_PREFERENCE, null);
    Uri sound = TextUtils.isEmpty(ringtone) ? null : Uri.parse(ringtone);

    Notification.Builder builder =
        new Notification.Builder(myContext.context())
            .setSmallIcon(
                MyPreferences.getBoolean(MyPreferences.KEY_NOTIFICATION_ICON_ALTERNATIVE, false)
                    ? R.drawable.notification_icon_circle
                    : R.drawable.notification_icon)
            .setContentTitle(myContext.context().getText(messageTitleResId))
            .setContentText(messageText)
            .setSound(sound);

    if (mNotificationsVibrate) {
      builder.setVibrate(new long[] {200, 300, 200, 300});
    }
    builder.setLights(Color.GREEN, 500, 1000);

    // Prepare "intent" to launch timeline activities exactly like in
    // org.andstatus.app.TimelineActivity.onOptionsItemSelected
    Intent intent = new Intent(myContext.context(), TimelineActivity.class);
    intent.setData(
        Uri.withAppendedPath(
            MatchedUri.getTimelineUri(
                0, timelineType, myContext.persistentAccounts().size() > 1, 0),
            "rnd/" + android.os.SystemClock.elapsedRealtime()));
    PendingIntent pendingIntent =
        PendingIntent.getActivity(
            myContext.context(),
            timelineType.hashCode(),
            intent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    builder.setContentIntent(pendingIntent);
    myContext.notify(timelineType, builder.build());
  }