@Test public void checkText() { RadioButton rb = new RadioButton("myRadioGroup", "foo"); Assert.assertEquals("foo", rb.getText()); rb.setText("text"); Assert.assertEquals("text", rb.getText()); }
private RadioButton findButtonForChoice(String choice) { for (RadioButton button : radioButtons) { if (button.getText().equals(choice)) { return button; } } throw new RuntimeException("No such choice found: " + choice); }
public String getSelectedChoice() { for (RadioButton button : radioButtons) { if (button.getValue()) { return button.getText(); } } throw new RuntimeException("No radio button selected"); }