TemplateDataTableWidget extends Composite implements
        InsertRowEvent.Handler,
        DeleteRowEvent.Handler,
        AppendRowEvent.Handler,
        CopyRowsEvent.Handler,
        PasteRowsEvent.Handler,
        UpdateModelEvent.Handler { @Override public void onInsertRow(InsertRowEvent event) { List<String> data = cellValueFactory.makeRowData(); model.addRow(event.getIndex(), data.toArray(new String[data.size()])); } TemplateDataTableWidget(TemplateModel model,
                                   AsyncPackageDataModelOracle oracle,
                                   boolean isReadOnly,
                                   EventBus globalEventBus); void appendRow(); @Override void setPixelSize(int width,
                             int height); @Override void onDeleteRow(DeleteRowEvent event); @Override void onCopyRows(CopyRowsEvent event); @Override void onPasteRows(PasteRowsEvent event); @Override void onInsertRow(InsertRowEvent event); @Override void onAppendRow(AppendRowEvent event); @Override void onUpdateModel(UpdateModelEvent event);  }
@Test public void testOnInsertRow() { final int index = 123; final List<String> rowData = Collections.singletonList("abc"); final InsertRowEvent insertRowEvent = mock(InsertRowEvent.class); when(insertRowEvent.getIndex()).thenReturn(index); when(cellValueFactoryMock.makeRowData()).thenReturn(rowData); dataTableWidget.onInsertRow(insertRowEvent); verify(modelMock).addRow(eq(index), eq(rowData.toArray(new String[1]))); }