### Question:
BeforeAfterTableModel extends AbstractTableModel { public void addRows(List<BeforeAfterRow> newRows) { myRows.addAll(newRows); if (!myRows.isEmpty()) { fireTableRowsInserted(0, myRows.size() - 1); } }  void addRows(List<BeforeAfterRow> newRows); void clear(); @Override int getColumnCount(); @Override String getColumnName(int column); BeforeAfterRow getRow(int rowIndex); @Override int getRowCount(); @Override Object getValueAt(int rowIndex, int columnIndex); void setColumnNamePrefix(String columnNamePrefix); static final String ourBeforeSuffix; static final String ourAfterSuffix; }### Answer:
@Test public void testAddRows() { EasyMockSupport support = new EasyMockSupport(); final List<BeforeAfterRow> rows = createTestRows(); TableModelListener listener = support.createMock(TableModelListener.class); listener.tableChanged(EasyMock.isA(TableModelEvent.class)); EasyMock.expectLastCall().andAnswer(new IAnswer<Void>() { @Override public Void answer() { TableModelEvent event = (TableModelEvent)EasyMock.getCurrentArguments()[0]; assertEquals(0, event.getFirstRow()); assertEquals(rows.size() - 1, event.getLastRow()); assertEquals(TableModelEvent.INSERT, event.getType()); return null; } }); support.replayAll(); BeforeAfterTableModel model = new BeforeAfterTableModel(); model.addTableModelListener(listener); model.addRows(New.<BeforeAfterRow>list()); model.addRows(rows); assertEquals(rows.size(), model.getRowCount()); for (int i = 0; i < rows.size(); i++) { assertEquals(rows.get(i).getBeforeValue(), model.getValueAt(i, 0)); assertEquals(rows.get(i).getAfterValue(), model.getValueAt(i, 1)); } support.verifyAll(); }