@Test
  public void testDefaultActionListeners() {
    AbstractCommandButton expandButton1 =
        GuiActionRunner.execute(
            new GuiQuery<AbstractCommandButton>() {
              @Override
              protected AbstractCommandButton executeInEDT() throws Throwable {
                return ((BasicRibbonBandUI) ribbonBand1.getUI()).getExpandButton();
              }
            });
    robot().waitForIdle();

    Assertions.assertThat(expandButton1).isNull();

    AbstractCommandButton expandButton2 =
        GuiActionRunner.execute(
            new GuiQuery<AbstractCommandButton>() {
              @Override
              protected AbstractCommandButton executeInEDT() throws Throwable {
                return ((BasicRibbonBandUI) ribbonBand2.getUI()).getExpandButton();
              }
            });
    robot().waitForIdle();

    Assertions.assertThat(expandButton2).isNotNull();

    robot().click(expandButton2);
    robot().waitForIdle();

    Assertions.assertThat(count1).isEqualTo(1);
    Assertions.assertThat(count2).isZero();
  }
  @Override
  protected void onSetUp() {
    GuiActionRunner.execute(
        new GuiTask() {
          @Override
          protected void executeInEDT() throws Throwable {
            count1 = 0;
            count2 = 0;

            ribbonFrame = new JRibbonFrame();

            ribbonBand1 = getSampleRibbonBand(null);
            ribbonBand2 = getSampleRibbonBand(new ExpandActionListener1());
            ribbonFrame.getRibbon().addTask(new RibbonTask("Task", ribbonBand1, ribbonBand2));

            Rectangle r =
                GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
            ribbonFrame.setPreferredSize(new Dimension(r.width, r.height / 2));
            ribbonFrame.pack();
            ribbonFrame.setLocation(r.x, r.y);
            ribbonFrame.setVisible(true);
            ribbonFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
          }
        });
  }
  @Test
  public void testSwitchFromNoListener() {
    AbstractCommandButton expandButton1 =
        GuiActionRunner.execute(
            new GuiQuery<AbstractCommandButton>() {
              @Override
              protected AbstractCommandButton executeInEDT() throws Throwable {
                return ((BasicRibbonBandUI) ribbonBand1.getUI()).getExpandButton();
              }
            });
    robot().waitForIdle();

    Assertions.assertThat(expandButton1).isNull();
    Assertions.assertThat(count1).isZero();
    Assertions.assertThat(count2).isZero();

    // set a non-null expand action listener on the first ribbon band
    GuiActionRunner.execute(
        new GuiTask() {
          @Override
          protected void executeInEDT() throws Throwable {
            ribbonBand1.setExpandActionListener(new ExpandActionListener1());
          }
        });
    robot().waitForIdle();

    expandButton1 =
        GuiActionRunner.execute(
            new GuiQuery<AbstractCommandButton>() {
              @Override
              protected AbstractCommandButton executeInEDT() throws Throwable {
                return ((BasicRibbonBandUI) ribbonBand1.getUI()).getExpandButton();
              }
            });
    robot().waitForIdle();

    Assertions.assertThat(expandButton1).isNotNull();

    robot().click(expandButton1);
    robot().waitForIdle();

    Assertions.assertThat(count1).isEqualTo(1);
    Assertions.assertThat(count2).isZero();
  }