### Question:
NotificationFormatter { public Notification replaceFormatPlaceholders(Notification notification) { String objectTypeLabelPlaceholder = NotificationConstants.OBJECT_TYPE_LABEL_PLACEHOLDER; String parentTypeLabelPlaceholder = NotificationConstants.PARENT_TYPE_LABEL_PLACEHOLDER; String notificationTitle = notification.getTitle(); if (notificationTitle != null && notificationTitle.contains(objectTypeLabelPlaceholder)) { String updatedTitle = replaceObjectTypeLabel(notificationTitle, objectTypeLabelPlaceholder, notification.getParentType()); notification.setTitle(updatedTitle); notificationTitle = updatedTitle; } if (notificationTitle != null && notificationTitle.contains(parentTypeLabelPlaceholder)) { String updatedTitle = replaceObjectTypeLabel(notificationTitle, parentTypeLabelPlaceholder, notification.getRelatedObjectType()); notification.setTitle(updatedTitle); } String notificationNote = notification.getNote(); if (notificationNote != null && notificationNote.contains(objectTypeLabelPlaceholder)) { String updatedNote = replaceObjectTypeLabel(notificationNote, objectTypeLabelPlaceholder, notification.getParentType()); notification.setNote(updatedNote); notificationNote = updatedNote; } if (notificationNote != null && notificationNote.contains(parentTypeLabelPlaceholder)) { String updatedNote = replaceObjectTypeLabel(notificationNote, parentTypeLabelPlaceholder, notification.getRelatedObjectType()); notification.setNote(updatedNote); } return notification; }  Notification replaceFormatPlaceholders(Notification notification); String replaceSubscriptionTitle(String title, String placeholder, String objectType); NotificationConfig getNotificationConfig(); void setNotificationConfig(NotificationConfig notificationConfig);  }### Answer:
@Test public void replaceObjectTypeLabelInTitle() { String parentType = "CASE_FILE"; String expectedTitle = "Title with label placeholder: object_label"; notification.setTitle("Title with label placeholder: " + NotificationConstants.OBJECT_TYPE_LABEL_PLACEHOLDER); notification.setParentType(parentType); notification.setNote(null); expect(mockConfig.getLabelForObjectType(parentType)).andReturn("object_label"); replayAll(); Notification updatedNotification = notificationFormatter.replaceFormatPlaceholders(notification); verifyAll(); assertEquals(updatedNotification.getTitle(), expectedTitle); }
@Test public void replaceObjectTypeLabelInNote() { String parentType = "CASE_FILE"; String expectedNote = "Note with label placeholder: object_label"; notification.setTitle(null); notification.setNote("Note with label placeholder: " + NotificationConstants.OBJECT_TYPE_LABEL_PLACEHOLDER); notification.setParentType(parentType); expect(mockConfig.getLabelForObjectType(parentType)).andReturn("object_label"); replayAll(); Notification updatedNotification = notificationFormatter.replaceFormatPlaceholders(notification); verifyAll(); assertEquals(updatedNotification.getNote(), expectedNote); }
@Test public void replaceParentTypeLabelInTitle() { String relatedType = "CASE_FILE"; String expectedTitle = "Title with label placeholder: parent_label"; notification.setNote(null); notification.setTitle("Title with label placeholder: " + NotificationConstants.PARENT_TYPE_LABEL_PLACEHOLDER); notification.setRelatedObjectType(relatedType); expect(mockConfig.getLabelForObjectType(relatedType)).andReturn("parent_label"); replayAll(); Notification updatedNotification = notificationFormatter.replaceFormatPlaceholders(notification); verifyAll(); assertEquals(updatedNotification.getTitle(), expectedTitle); }
@Test public void replaceParentTypeLabelInNote() { String relatedType = "CASE_FILE"; String expectedNote = "Note with label placeholder: parent_label"; notification.setNote("Note with label placeholder: " + NotificationConstants.PARENT_TYPE_LABEL_PLACEHOLDER); notification.setRelatedObjectType(relatedType); notification.setTitle(null); expect(mockConfig.getLabelForObjectType(relatedType)).andReturn("parent_label"); replayAll(); Notification updatedNotification = notificationFormatter.replaceFormatPlaceholders(notification); verifyAll(); assertEquals(updatedNotification.getNote(), expectedNote); }