DownloadCompleteNotification extends KujakuNotification { public void displayNotification(String title, String content, int notificationId) { NotificationCompat.Builder notificationBuilder = createNotification(title, content); displayNotification(notificationBuilder, notificationId); } DownloadCompleteNotification(Context context); void displayNotification(String title, String content, int notificationId); static final String CHANNEL_ID; static final int NOTIFICATION_COLOR; static final long[] VIBRATION_PATTERN; }
@Test public void displayNotificationShouldShowValidNotificationWhenGivenTitleAndContent() { DownloadCompleteNotification downloadCompleteNotification = new DownloadCompleteNotification(context); String title = "This is a sample title"; String content = "content text"; int notificationId = 209234; downloadCompleteNotification.displayNotification(title, content, notificationId); ShadowNotificationManager shadowNotificationManager = Shadows.shadowOf((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE)); Notification actualNotification = shadowNotificationManager.getNotification(notificationId); ShadowNotification shadowNotification = Shadows.shadowOf(actualNotification); assertNotNull(actualNotification); assertEquals(title, shadowNotification.getContentTitle()); assertEquals(content, shadowNotification.getContentText()); }