//...and that the model has not been altered
Assert.assertEquals(4, model.getRowCount());
}
//Create some mock listeners and add them to the model
TableModelListener listener1 = (TableModelListener) EasyMock.createMock(TableModelListener.class);
TableModelListener listener2 = (TableModelListener) EasyMock.createMock(TableModelListener.class);
model.addTableModelListener(listener1);
model.addTableModelListener(listener2);
//For the next test, remove the second and third rows and confirm that the model now
//contains only two rows and that the listeners were notified correctly
//Create the expected event
TableModelEvent expectedEvent = new TableModelEvent(model,
1,
2,
TableModelEvent.ALL_COLUMNS,
TableModelEvent.DELETE);
//set the expectations on the listeners and switch them to replay mode
listener1.tableChanged(matchEvent(expectedEvent));
listener2.tableChanged(matchEvent(expectedEvent));
EasyMock.replay(listener1);
EasyMock.replay(listener2);
//execute the test
model.remove(1, 2);