### Question:
BenefitRiskMeasurementTableModel extends AbstractTableModel { public Object getValueAt(int rowIndex, int columnIndex) { OutcomeMeasure om = d_br.getCriteria().get(rowIndex); switch (columnIndex) { case 0: return om.getLabel(); case 1: return om.getDirection(); case 2: return om.getDescription(); case 3: return getUnitOfMeasurement(om); default: { Alternative a = d_br.getAlternatives().get(columnIndex - EXTRA_COLUMNS); return d_br.getMeasurement(om, a); } } } BenefitRiskMeasurementTableModel(BenefitRiskAnalysis<Alternative> bra); int getColumnCount(); int getRowCount(); @Override boolean isCellEditable(int row, int col); @Override String getColumnName(int index); @Override Class<?> getColumnClass(int index); Object getValueAt(int rowIndex, int columnIndex); static final int EXTRA_COLUMNS; }### Answer:
@Test public void testGetOutcomeNames() { List<OutcomeMeasure> outcomeMeasures = d_brAnalysis.getCriteria(); for (int j=0; j<outcomeMeasures.size(); ++j) { assertEquals(outcomeMeasures.get(j).toString(), d_pm.getValueAt(j, 0)); } }
@Test public void testGetValueAt() { for (int i = 0; i < d_brAnalysis.getAlternatives().size(); ++i) { for (int j = 0; j < d_brAnalysis.getCriteria().size(); ++j) { TreatmentDefinition drug = d_brAnalysis.getAlternatives().get(i); OutcomeMeasure om = d_brAnalysis.getCriteria().get(j); GaussianBase expected = (GaussianBase)d_brAnalysis.getMeasurement(om, drug); GaussianBase actual = (GaussianBase) d_pm.getValueAt(j, i + BenefitRiskMeasurementTableModel.EXTRA_COLUMNS); assertEquals(expected.getMu(), actual.getMu(), 0.000001); assertEquals(expected.getSigma(), actual.getSigma(), 0.000001); } } }