### Question:
DefaultNotificationFilterDisplayer extends AbstractNotificationFilterDisplayer { @Override public Block display(NotificationFilter filter, NotificationFilterPreference preference) throws NotificationException { try { setUpContext(scriptContextManager, filter, preference); String templateName = String.format("notification/filters/%s.vm", filter.getName().replaceAll("\\/", ".")); Template template = templateManager.getTemplate(templateName); return (template != null) ? templateManager.execute(template) : templateManager.execute("notification/filters/default.vm"); } catch (Exception e) { throw new NotificationException( String.format("Failed to display the notification filter [%s] with the filter preference [%s].", filter, preference), e); } finally { cleanUpContext(); } }  @Override Block display(NotificationFilter filter, NotificationFilterPreference preference); @Override Set<String> getSupportedFilters();  }### Answer:
@Test public void displayWithCustomTemplate() throws Exception { Template fakeTemplate = mock(Template.class); when(templateManager.getTemplate(any(String.class))).thenReturn(fakeTemplate); NotificationFilter filter = mock(NotificationFilter.class); when(filter.getName()).thenReturn("filterName"); mocker.getComponentUnderTest() .display(filter, mock(NotificationFilterPreference.class)); verify(templateManager, times(1)).execute(eq(fakeTemplate)); }
@Test public void displayWithDefaultTemplate() throws Exception { when(templateManager.getTemplate(any(String.class))).thenReturn(null); NotificationFilter filter = mock(NotificationFilter.class); when(filter.getName()).thenReturn("filterName"); mocker.getComponentUnderTest() .display(filter, mock(NotificationFilterPreference.class)); verify(templateManager, times(1)).execute(eq("notification/filters/default.vm")); }