@Test public void testCstr_StringAction() { final Action a = new AbstractAction() { /** default */ private static final long serialVersionUID = 1L; @Override public void actionPerformed(final ActionEvent e) {} }; JRadioButtonFixture rb = new JRadioButtonFixture(robot(), getRadioButton("rb", a)); rb.requireNotSelected(); assertThat(rb.component().getName()).isEqualTo("rb"); assertThat(rb.component().getAction()).isEqualTo(a); rb = new JRadioButtonFixture(robot(), getRadioButton("", a)); rb.requireNotSelected(); assertThat(rb.component().getName()).isEqualTo(""); assertThat(rb.component().getAction()).isEqualTo(a); rb = new JRadioButtonFixture(robot(), getRadioButton(null, a)); rb.requireNotSelected(); assertThat(rb.component().getName()).isNull(); assertThat(rb.component().getAction()).isEqualTo(a); }
@Test public void testCstr_StringStringBoolean() { JRadioButtonFixture rb = new JRadioButtonFixture(robot(), getRadioButton("rb", "", true)); assertThat(rb.component().getName()).isEqualTo("rb"); rb.requireSelected(); rb.requireText(""); rb = new JRadioButtonFixture(robot(), getRadioButton("", (String) null, true)); rb.requireSelected(); rb.requireText(""); assertThat(rb.component().getName()).isEqualTo(""); rb = new JRadioButtonFixture(robot(), getRadioButton(null, "txt", false)); rb.requireNotSelected(); rb.requireText("txt"); assertThat(rb.component().getName()).isNull(); }
@Test public void testCstr_StringStringIconBoolean() { Icon i = new ImageIcon(); JRadioButtonFixture rb = new JRadioButtonFixture(robot(), getRadioButton("rb", null, i, true)); rb.requireSelected(); rb.requireText(""); assertThat(rb.component().getName()).isEqualTo("rb"); assertThat(rb.component().getIcon()).isEqualTo(i); rb = new JRadioButtonFixture(robot(), getRadioButton("", "txt", null, false)); rb.requireNotSelected(); rb.requireText("txt"); assertThat(rb.component().getName()).isEqualTo(""); assertThat(rb.component().getIcon()).isNull(); i = new ImageIcon(new byte[27]); rb = new JRadioButtonFixture(robot(), getRadioButton(null, "", i, true)); rb.requireSelected(); rb.requireText(""); assertThat(rb.component().getName()).isNull(); assertThat(rb.component().getIcon()).isEqualTo(i); }
@Test public void testCstr_String() { JRadioButtonFixture rb = new JRadioButtonFixture(robot(), getRadioButton("rb")); assertThat(rb.component().getName()).isEqualTo("rb"); rb.requireNotSelected(); rb = new JRadioButtonFixture(robot(), getRadioButton("")); rb.requireNotSelected(); assertThat(rb.component().getName()).isEqualTo(""); rb = new JRadioButtonFixture(robot(), getRadioButton(null)); rb.requireNotSelected(); assertThat(rb.component().getName()).isNull(); }
@Test public void testCstr_StringIcon() { Icon i = new ImageIcon(); JRadioButtonFixture rb = new JRadioButtonFixture(robot(), getRadioButton("rb", i)); rb.requireNotSelected(); assertThat(rb.component().getName()).isEqualTo("rb"); assertThat(rb.component().getIcon()).isEqualTo(i); rb = new JRadioButtonFixture(robot(), getRadioButton("", (Icon) null)); rb.requireNotSelected(); assertThat(rb.component().getName()).isEqualTo(""); assertThat(rb.component().getIcon()).isNull(); i = new ImageIcon(new byte[27]); rb = new JRadioButtonFixture(robot(), getRadioButton(null, i)); rb.requireNotSelected(); assertThat(rb.component().getName()).isNull(); assertThat(rb.component().getIcon()).isEqualTo(i); }