### Question:
NotificationData { public AddNotificationResult addNotificationContent(NotificationContent content) { int notificationId; boolean cancelNotificationIdBeforeReuse; if (isMaxNumberOfActiveNotificationsReached()) { NotificationHolder notificationHolder = activeNotifications.removeLast(); addToAdditionalNotifications(notificationHolder); notificationId = notificationHolder.notificationId; cancelNotificationIdBeforeReuse = true; } else { notificationId = getNewNotificationId(); cancelNotificationIdBeforeReuse = false; } NotificationHolder notificationHolder = createNotificationHolder(notificationId, content); activeNotifications.addFirst(notificationHolder); if (cancelNotificationIdBeforeReuse) { return AddNotificationResult.replaceNotification(notificationHolder); } else { return AddNotificationResult.newNotification(notificationHolder); } } NotificationData(Account account); AddNotificationResult addNotificationContent(NotificationContent content); boolean containsStarredMessages(); boolean hasSummaryOverflowMessages(); int getSummaryOverflowMessagesCount(); int getNewMessagesCount(); boolean isSingleMessageNotification(); NotificationHolder getHolderForLatestNotification(); List<NotificationContent> getContentForSummaryNotification(); int[] getActiveNotificationIds(); RemoveNotificationResult removeNotificationForMessage(MessageReference messageReference); Account getAccount(); int getUnreadMessageCount(); void setUnreadMessageCount(int unreadMessageCount); ArrayList<MessageReference> getAllMessageReferences();  }### Answer:
@Test public void testAddNotificationContent() throws Exception { NotificationContent content = createNotificationContent("1"); AddNotificationResult result = notificationData.addNotificationContent(content); assertFalse(result.shouldCancelNotification()); NotificationHolder holder = result.getNotificationHolder(); assertNotNull(holder); assertEquals(NotificationIds.getNewMailStackedNotificationId(account, 0), holder.notificationId); assertEquals(content, holder.content); }
@Test public void testAddNotificationContentWithReplacingNotification() throws Exception { notificationData.addNotificationContent(createNotificationContent("1")); notificationData.addNotificationContent(createNotificationContent("2")); notificationData.addNotificationContent(createNotificationContent("3")); notificationData.addNotificationContent(createNotificationContent("4")); notificationData.addNotificationContent(createNotificationContent("5")); notificationData.addNotificationContent(createNotificationContent("6")); notificationData.addNotificationContent(createNotificationContent("7")); notificationData.addNotificationContent(createNotificationContent("8")); AddNotificationResult result = notificationData.addNotificationContent(createNotificationContent("9")); assertTrue(result.shouldCancelNotification()); assertEquals(NotificationIds.getNewMailStackedNotificationId(account, 0), result.getNotificationId()); }