SourceTypeSelector extends VerticalPanel implements ValueChangeHandler<Boolean> { protected void addRadioButtons() { boolean first = true; radioButtonList.clear(); for (ScenarioSimulationModel.Type sourceType : ScenarioSimulationModel.Type.values()) { Radio radioButton = new Radio(SOURCE_TYPE); radioButton.setText(sourceType.name()); radioButton.setValue(first); radioButton.addValueChangeHandler(this); first = false; radioButtonList.add(radioButton); add(radioButton); } uploadWidget.setVisible(isDMNSelected()); } SourceTypeSelector(TitledAttachmentFileWidget uploadWidget); @Override void onValueChange(ValueChangeEvent<Boolean> event); boolean validate(); boolean isDMNSelected(); ScenarioSimulationModel.Type getSelectedType();  }
@Test public void addRadioButtons() { reset(uploadWidgetMock); sourceTypeSelector.addRadioButtons(); assertEquals(2, sourceTypeSelector.radioButtonList.size()); verify(uploadWidgetMock, times(1)).setVisible(false); }