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(expected = IllegalArgumentException.class)
  public void testSetMetadataIllegalType() {
    NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_NORMAL_ID);
    NotificationConstants.setMetadata(context, builder, -1);
    NotificationConstants.setMetadata(context, builder, 2);
    NotificationConstants.setMetadata(context, builder, Integer.MAX_VALUE);
    builder = new NotificationCompat.Builder(context, CHANNEL_FTP_ID);
    NotificationConstants.setMetadata(context, builder, -1);
    NotificationConstants.setMetadata(context, builder, 2);
    NotificationConstants.setMetadata(context, builder, Integer.MAX_VALUE);
  }