MetricDisplayer extends AbstractGwtDisplayer<MetricDisplayer.View> implements HasHtmlTemplate, HasJsTemplate { @Override public View getView() { return view; } @Inject  MetricDisplayer(View view); @Override View getView(); @Override DisplayerConstraints createDisplayerConstraints(); String parseHtmlTemplate(String str); String parseJsTemplate(String str); String getExtraKeyId(String key); boolean isFilterOn(); void setFilterOn(boolean on); boolean isFilterEnabled(); void updateFilter(); DataSetFilter fetchFilter(); void filterApply(); @Override void filterReset(); @Override String getHtmlTemplate(); @Override Map<String, String> getHtmlVariableMap(); @Override String getJsTemplate(); @Override Map<String, String> getJsVariableMap(); static final List<String> TEMPLATE_KEYS; static final String DEFAULT_HTML_TEMPLATE; static final String DEFAULT_JS_TEMPLATE; }
@Test public void testNoData() { DisplayerSettings empty = DisplayerSettingsFactory.newMetricSettings() .dataset(EXPENSES) .filter(COLUMN_ID, FilterFactory.isNull()) .column(COLUMN_AMOUNT) .title("Title").titleVisible(true) .width(300).height(200) .margins(10, 20, 30, 40) .backgroundColor("FDE8D4") .htmlTemplate(HTML_TEMPLATE) .buildSettings(); when(view.getNoDataString()).thenReturn("0,0"); MetricDisplayer presenter = createMetricDisplayer(empty); MetricDisplayer.View view = presenter.getView(); presenter.draw(); verify(view, atLeastOnce()).getNoDataString(); verify(view).setHtml("<div id=\"test_this\" style=\"background-color:#FDE8D4; width:300px; height:200px; " + "margin-top:10px; margin-right:40px; margin-bottom:20px; margin-left:30px;\">\n" + " <span>Title</span>\n" + " <span>0,0</span>\n" + "</div>"); }