@Test public void testFormatDateFor10Min() throws Exception { String expected = FormatterCalendar.format(FilterRange.R10MIN, date); table.setFormatterCalendar(FilterRange.R10MIN); table.setItems(items); Object firstPeriod = getFirstPeriod(); assertEquals(expected, firstPeriod); }
@Test public void testTotal() throws Exception { table.setItems(items); assertItemAndValue(TimingsTable.PERIOD, TimingsTable.TOTAL); assertItemAndValue(TimingsType.MIN.getName(), "5"); assertItemAndValue(TimingsType.MAX.getName(), "10"); assertItemAndValue(TimingsType.AVG.getName(), "26"); assertItemAndValue(TimingsType.P90.getName(), "19"); assertItemAndValue(TimingsType.P95.getName(), "13"); assertItemAndValue(TimingsType.P99.getName(), "25"); assertItemAndValue(TimingsType.QUERIES.getName(), "7"); assertItemAndValue(TimingsType.ERRORS.getName(), "17"); }
@Test public void testClearTotal() throws Exception { table.setItems(items); testTotal(); }
@Test public void testRemoveAllItems() throws Exception { table.setItems(items); testCountRows(); }
@Test public void testCountRows() throws Exception { table.setItems(items); int size = table.getItemIds().size(); assertEquals(3, size); }
@Test public void testCountColumns() throws Exception { int size = table.getColumnHeaders().length; assertEquals(9, size); }
public void assertItemAndValue(String columnId, Object value) { String footer = table.getColumnFooter(columnId); assertEquals(value, footer); }
private Object getFirstPeriod() { Object itemId = table.getCurrentPageFirstItemId(); Item item = table.getItem(itemId); Property property = item.getItemProperty(TimingsTable.PERIOD); return property.getValue(); }