PlotSettingsComboBox extends PlotSettingsSubPanel { public void setText(T object, String text) { ItemWrapper<T> item = items.get(object); if (item != null) { item.text = text; } } PlotSettingsComboBox(T... choices); void setSelection(T object); @SuppressWarnings("unchecked") T getSelection(); @Override boolean isDirty(); @Override boolean isValidated(); void setText(T object, String text);  }
@Test public void testSetText() { @SuppressWarnings({ "rawtypes", "unchecked" }) Tester<Integer> t = new Tester(INTEGER_CHOICES, Integer.class); JComboBox b = null; for (Component c : t.getComponents()) { if (c instanceof JComboBox) { b = (JComboBox) c; } } Assert.assertNotNull(b); for (int i = 0; i < 3; i++) { Assert.assertEquals(b.getItemAt(i).toString(), INTEGER_CHOICES[i].toString()); } for (int i = 0; i < 3; i++) { t.setText(INTEGER_CHOICES[i], STRING_CHOICES[i]); } for (int i = 0; i < 3; i++) { Assert.assertEquals(b.getItemAt(i).toString(), STRING_CHOICES[i].toString()); } }