PlotSettingsComboBox extends PlotSettingsSubPanel { @SuppressWarnings("unchecked") public T getSelection() { ItemWrapper<T> wrapper = ((ItemWrapper<T>) comboBox.getSelectedItem()); return wrapper == null ? null : wrapper.item; } 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 testHardAndSoftReset() { for (Object[] choices : new Object[][]{STRING_CHOICES, INTEGER_CHOICES}) { for (int i = 0; i < 3; i++) { @SuppressWarnings({ "rawtypes", "unchecked" }) Tester<?> t = new Tester(choices, choices[i].getClass()); if (choices[i] instanceof Integer) { settings.setMinTime((Integer) choices[i]); } else if (choices[i] instanceof String) { settings.setTimeSystemSetting((String) choices[i]); } t.reset(settings, true); Assert.assertEquals(t.getSelection(), choices[i]); if (choices[i] instanceof Integer) { settings.setMinTime((Integer) choices[(i+1)%3]); } else if (choices[i] instanceof String) { settings.setTimeSystemSetting((String) choices[(i+1)%3]); } t.reset(settings, false); Assert.assertEquals(t.getSelection(), choices[i]); if (choices[i] instanceof Integer) { settings.setMinTime((Integer) choices[(i+2)%3]); } else if (choices[i] instanceof String) { settings.setTimeSystemSetting((String) choices[(i+2)%3]); } t.reset(settings, true); Assert.assertEquals(t.getSelection(), choices[(i+2)%3]); } } }