@Test public void renderSingleEvent() throws Exception { CompositeEvent compositeEvent = mock(CompositeEvent.class); CompositeEventStatus eventStatus = mock(CompositeEventStatus.class); when(compositeEvent.getType()).thenReturn("FooType"); when(compositeEvent.getEventIds()).thenReturn(Arrays.asList("foo", "bar", "baz")); when(compositeEvent.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-event"); when(eventRenderer.render(compositeEvent)).thenReturn(block); when(eventStatus.getStatus()).thenReturn(false); String expectedResult = "<div data-eventtype=\"FooType\" data-ids=\"foo,bar,baz\" data-eventdate=\"42\" " + "class=\"notification-event notification-event-unread\">" + "<div class=\"my-composite-event\"></div></div>"; assertEquals(expectedResult, this.notificationRenderer.render(compositeEvent, eventStatus)); when(eventStatus.getStatus()).thenReturn(true); expectedResult = "<div data-eventtype=\"FooType\" data-ids=\"foo,bar,baz\" data-eventdate=\"42\" " + "class=\"notification-event\">" + "<div class=\"my-composite-event\"></div></div>"; assertEquals(expectedResult, this.notificationRenderer.render(compositeEvent, eventStatus)); expectedResult = "<div data-eventtype=\"FooType\" data-ids=\"foo,bar,baz\" data-eventdate=\"42\" " + "class=\"notification-event\">" + "<div class=\"my-composite-event\"></div></div>"; assertEquals(expectedResult, this.notificationRenderer.render(compositeEvent, null)); }
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);  }