Пример #1
0
  @Test
  public void testCButton_Action() throws InterruptedException, InvocationTargetException {
    final Action act =
        new AbstractAction() {
          /** serial version UID */
          private static final long serialVersionUID = -2312442386490910405L;

          @Override
          public void actionPerformed(final ActionEvent e) {
            // do nothing, stupid stub
          }
        };
    CButton button = getButton(act);
    assertThat(button.getAction()).isSameAs(act);

    button = getButton((AbstractAction) null);
    assertThat(button.getAction()).isNull();
  }
Пример #2
0
  @Test
  public void testCButton_StringAction() {
    CButton item = getButton("item", (Action) null);
    assertThat(item.getName()).isEqualTo("item");
    assertThat(item.getAction()).isNull();

    item =
        getButton(
            "",
            new AbstractAction("ACTION") {
              /** ... */
              private static final long serialVersionUID = 1L;

              @Override
              public void actionPerformed(final ActionEvent e) {}
            });
    assertThat(item.getName()).isEmpty();
    assertThat(item.getText()).isEqualTo("ACTION");
    assertThat(item.getAction()).isInstanceOf(AbstractAction.class);
  }