@Config(sdk = 25) @Test public void createNotificationShouldCreateValidNotificationBuilderWithoutTextOrChannelId() throws NoSuchFieldException, IllegalAccessException { KujakuNotificationImplClass kujakuNotification = new KujakuNotificationImplClass(); String title = "sample tiTle 4"; NotificationCompat.Builder builder = kujakuNotification.createNotification(title); assertNotificationBuilder(builder, title, null, null); assertEquals(null, getValueInPrivateField(NotificationCompat.Builder.class, builder, "mChannelId")); }
@SuppressWarnings("deprecation") public NotificationCompat.Builder createNotification(String title, @Nullable String content) { NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setContentTitle(title) .setSmallIcon(smallIcon); if (content != null) { builder.setContentText(content); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { builder.setChannelId(notificationChannel.getId()); } return builder; }
KujakuNotification { @SuppressWarnings("deprecation") public NotificationCompat.Builder createNotification(String title, @Nullable String content) { NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setContentTitle(title) .setSmallIcon(smallIcon); if (content != null) { builder.setContentText(content); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { builder.setChannelId(notificationChannel.getId()); } return builder; } }
KujakuNotification { @SuppressWarnings("deprecation") public NotificationCompat.Builder createNotification(String title, @Nullable String content) { NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setContentTitle(title) .setSmallIcon(smallIcon); if (content != null) { builder.setContentText(content); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { builder.setChannelId(notificationChannel.getId()); } return builder; }  }
KujakuNotification { @SuppressWarnings("deprecation") public NotificationCompat.Builder createNotification(String title, @Nullable String content) { NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setContentTitle(title) .setSmallIcon(smallIcon); if (content != null) { builder.setContentText(content); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { builder.setChannelId(notificationChannel.getId()); } return builder; }  void createNotificationChannel(int importance, String channelName, String channelId); void createNotificationChannel(int importance, String channelName, String channelId, @Nullable String description); void createNotificationChannel(int importance, String channelName, String channelId, @Nullable String description, @ColorInt int ledColor, @Nullable long[] vibrationPattern); @RequiresApi(api = Build.VERSION_CODES.O) void createNotificationChannel(int importance, String channelName, String channelId, @Nullable String description, @ColorInt int ledColor); @RequiresApi(api = Build.VERSION_CODES.O) void createNotificationChannel(int importance, String channelName, String channelId, @Nullable String description, long[] vibrationPattern); @SuppressWarnings("deprecation") NotificationCompat.Builder createNotification(String title, @Nullable String content); NotificationCompat.Builder createNotification(String title); void displayNotification(NotificationCompat.Builder notificationBuilder, int notificationId); void setSmallIcon(int icon); void setContext(Context context); }
KujakuNotification { @SuppressWarnings("deprecation") public NotificationCompat.Builder createNotification(String title, @Nullable String content) { NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setContentTitle(title) .setSmallIcon(smallIcon); if (content != null) { builder.setContentText(content); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { builder.setChannelId(notificationChannel.getId()); } return builder; }  void createNotificationChannel(int importance, String channelName, String channelId); void createNotificationChannel(int importance, String channelName, String channelId, @Nullable String description); void createNotificationChannel(int importance, String channelName, String channelId, @Nullable String description, @ColorInt int ledColor, @Nullable long[] vibrationPattern); @RequiresApi(api = Build.VERSION_CODES.O) void createNotificationChannel(int importance, String channelName, String channelId, @Nullable String description, @ColorInt int ledColor); @RequiresApi(api = Build.VERSION_CODES.O) void createNotificationChannel(int importance, String channelName, String channelId, @Nullable String description, long[] vibrationPattern); @SuppressWarnings("deprecation") NotificationCompat.Builder createNotification(String title, @Nullable String content); NotificationCompat.Builder createNotification(String title); void displayNotification(NotificationCompat.Builder notificationBuilder, int notificationId); void setSmallIcon(int icon); void setContext(Context context); static final int NO_LED_COLOR; }