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