public static void setMetadata(
      Context context, NotificationCompat.Builder notification, int type) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
      switch (type) {
        case TYPE_NORMAL:
          createNormalChannel(context);
          break;
        case TYPE_FTP:
          createFtpChannel(context);
          break;
        default:
          throw new IllegalArgumentException("Unrecognized type:" + type);
      }
    } else {
      switch (type) {
        case TYPE_NORMAL:
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            notification.setCategory(Notification.CATEGORY_SERVICE);
          }
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            notification.setPriority(Notification.PRIORITY_MIN);
          }
          break;
        case TYPE_FTP:
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            notification.setCategory(Notification.CATEGORY_SERVICE);
            notification.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
          }
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            notification.setPriority(Notification.PRIORITY_MAX);
          }
          break;
        default:
          throw new IllegalArgumentException("Unrecognized type:" + type);
      }
    }
  }
@Test
  @Config(sdk = {KITKAT}) // max sdk is N
  public void testNormalNotification() {
    NotificationCompat.Builder builder =
        new NotificationCompat.Builder(context, CHANNEL_NORMAL_ID)
            .setContentTitle(context.getString(R.string.waiting_title))
            .setContentText(context.getString(R.string.waiting_content))
            .setAutoCancel(false)
            .setSmallIcon(R.drawable.ic_all_inclusive_white_36dp)
            .setProgress(0, 0, true);

    NotificationConstants.setMetadata(context, builder, TYPE_NORMAL);
    Notification result = builder.build();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      assertEquals(Notification.CATEGORY_SERVICE, result.category);
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
      assertEquals(Notification.PRIORITY_MIN, result.priority);
    } else {
      assertEquals(Notification.PRIORITY_DEFAULT, result.priority);
    }
  }