### Question:
CheckBoxTableModel extends AbstractTableModel { public void setCheckedValues(Collection<? extends String> values) { Utilities.checkNull(values, "values"); for (int index = 0; index < myValues.size(); ++index) { myBooleans.set(index, Boolean.valueOf(values.contains(myValues.get(index)))); } fireTableDataChanged(); } CheckBoxTableModel(String checkBoxHeader, String valueHeader, Boolean initialCheckBoxState,
            Collection<? extends String> values); List<String> getCheckedValues(); @Override Class<?> getColumnClass(int columnIndex); @Override int getColumnCount(); @Override String getColumnName(int column); @Override int getRowCount(); @Override Object getValueAt(int rowIndex, int columnIndex); @Override boolean isCellEditable(int rowIndex, int columnIndex); void setCheckedValues(Collection<? extends String> values); @Override void setValueAt(Object aValue, int rowIndex, int columnIndex);  }### Answer:
@Test public void testSetCheckedValues() { TableModelListener listener = EasyMock.createMock(TableModelListener.class); listener.tableChanged(EasyMock.isA(TableModelEvent.class)); EasyMock.replay(listener); myModel.addTableModelListener(listener); Assert.assertEquals(VALUES, myModel.getCheckedValues()); myModel.setCheckedValues(VALUES.subList(1, VALUES.size())); Assert.assertEquals(VALUES.subList(1, VALUES.size()), myModel.getCheckedValues()); EasyMock.verify(listener); EasyMock.reset(listener); listener.tableChanged(EasyMock.isA(TableModelEvent.class)); EasyMock.replay(listener); myModel.setCheckedValues(Arrays.asList("one", "three", "four")); Assert.assertEquals(Arrays.asList("one", "three", "four"), myModel.getCheckedValues()); EasyMock.verify(listener); EasyMock.reset(listener); listener.tableChanged(EasyMock.isA(TableModelEvent.class)); EasyMock.replay(listener); myModel.setCheckedValues(Collections.<String>emptyList()); Assert.assertTrue(myModel.getCheckedValues().isEmpty()); EasyMock.verify(listener); }