@Test public void renderMany() throws NotificationException { WordBlock wordBlock = new WordBlock("Nothing"); Translation translation = mock(Translation.class); when(localizationManager.getTranslation("notifications.menu.nothing")).thenReturn(translation); when(translation.render()).thenReturn(wordBlock); String expectedResult = "<p class=\"text-center noitems\">Nothing</p>"; assertEquals(expectedResult, this.notificationRenderer.render(Collections.emptyList(), Collections.emptyList(), false)); CompositeEvent compositeEvent1 = mock(CompositeEvent.class); CompositeEventStatus eventStatus1 = mock(CompositeEventStatus.class); when(compositeEvent1.getType()).thenReturn("FooType"); when(compositeEvent1.getEventIds()).thenReturn(Arrays.asList("foo", "bar", "baz")); when(compositeEvent1.getDates()).thenReturn(Arrays.asList( new Date(0), new Date(10), new Date(12), new Date(42) )); GroupBlock block = new GroupBlock(); block.setParameter("class", "my-composite-event1"); when(eventRenderer.render(compositeEvent1)).thenReturn(block); when(eventStatus1.getStatus()).thenReturn(false); CompositeEvent compositeEvent2 = mock(CompositeEvent.class); CompositeEventStatus eventStatus2 = mock(CompositeEventStatus.class); when(compositeEvent2.getType()).thenReturn("BarType"); when(compositeEvent2.getEventIds()).thenReturn(Collections.singletonList("oneId")); when(compositeEvent2.getDates()).thenReturn(Arrays.asList( new Date(12) )); Block block2 = new GroupBlock(); block2.setParameter("class", "my-composite-event2"); when(eventRenderer.render(compositeEvent2)).thenReturn(block2); when(eventStatus2.getStatus()).thenReturn(true); expectedResult = "<div data-eventtype=\"FooType\" data-ids=\"foo,bar,baz\" data-eventdate=\"42\" " + "class=\"notification-event notification-event-unread\">" + "<div class=\"my-composite-event1\"></div></div>" + "<div data-eventtype=\"BarType\" data-ids=\"oneId\" data-eventdate=\"12\" class=\"notification-event\">" + "<div class=\"my-composite-event2\"></div></div>" + "<div class=\"notifications-macro-load-more\"></div>"; assertEquals(expectedResult, this.notificationRenderer.render( Arrays.asList(compositeEvent1, compositeEvent2), Arrays.asList(eventStatus1, eventStatus2), true)); expectedResult = "<div data-eventtype=\"FooType\" data-ids=\"foo,bar,baz\" data-eventdate=\"42\" " + "class=\"notification-event\">" + "<div class=\"my-composite-event1\"></div></div>" + "<div data-eventtype=\"BarType\" data-ids=\"oneId\" data-eventdate=\"12\" class=\"notification-event\">" + "<div class=\"my-composite-event2\"></div></div>" + "<div class=\"notifications-macro-load-more\"></div>"; assertEquals(expectedResult, this.notificationRenderer.render( Arrays.asList(compositeEvent1, compositeEvent2), null, true)); }
public String render(int count) { String displayCount = String.valueOf(count); FormatBlock formatBlock = new FormatBlock(); WordBlock wordBlock = new WordBlock(displayCount); formatBlock.addChild(wordBlock); formatBlock.setParameter(CLASS_PARAMETER, "notifications-count badge"); WikiPrinter printer = new DefaultWikiPrinter(); this.htmlRenderer.render(formatBlock, printer); return printer.toString(); }
InternalHtmlNotificationRenderer { public String render(int count) { String displayCount = String.valueOf(count); FormatBlock formatBlock = new FormatBlock(); WordBlock wordBlock = new WordBlock(displayCount); formatBlock.addChild(wordBlock); formatBlock.setParameter(CLASS_PARAMETER, "notifications-count badge"); WikiPrinter printer = new DefaultWikiPrinter(); this.htmlRenderer.render(formatBlock, printer); return printer.toString(); } }
InternalHtmlNotificationRenderer { public String render(int count) { String displayCount = String.valueOf(count); FormatBlock formatBlock = new FormatBlock(); WordBlock wordBlock = new WordBlock(displayCount); formatBlock.addChild(wordBlock); formatBlock.setParameter(CLASS_PARAMETER, "notifications-count badge"); WikiPrinter printer = new DefaultWikiPrinter(); this.htmlRenderer.render(formatBlock, printer); return printer.toString(); }  }
InternalHtmlNotificationRenderer { public String render(int count) { String displayCount = String.valueOf(count); FormatBlock formatBlock = new FormatBlock(); WordBlock wordBlock = new WordBlock(displayCount); formatBlock.addChild(wordBlock); formatBlock.setParameter(CLASS_PARAMETER, "notifications-count badge"); WikiPrinter printer = new DefaultWikiPrinter(); this.htmlRenderer.render(formatBlock, printer); return printer.toString(); }  String render(int count); String render(CompositeEvent compositeEvent, CompositeEventStatus status); String render(List<CompositeEvent> compositeEvents, List<CompositeEventStatus> compositeEventStatuses,
        boolean loadMore); }
InternalHtmlNotificationRenderer { public String render(int count) { String displayCount = String.valueOf(count); FormatBlock formatBlock = new FormatBlock(); WordBlock wordBlock = new WordBlock(displayCount); formatBlock.addChild(wordBlock); formatBlock.setParameter(CLASS_PARAMETER, "notifications-count badge"); WikiPrinter printer = new DefaultWikiPrinter(); this.htmlRenderer.render(formatBlock, printer); return printer.toString(); }  String render(int count); String render(CompositeEvent compositeEvent, CompositeEventStatus status); String render(List<CompositeEvent> compositeEvents, List<CompositeEventStatus> compositeEventStatuses,
        boolean loadMore);  }