views:

45

answers:

1

I have a test that sometimes fails on the requireSelected() call, and I can't figure out why.

public void testSimple() {
  JRadioButtonFixture fixture = getFixture();
  fixture.check();
  fixture.requireSelected().requireVisible();
}

I tried changing the code to run on the EDT instead of in the test's main, but none of the fixture's methods are allowed to be invoked from the EDT it seems.

Why does this test fail?

Update: More details:

There isn't anything in the setUp().

Here's the failure trace:

Java.lang.AssertionError: [javax.swing.JRadioButton[name='button', text='text', selected=false, enabled=true, visible=true, showing=true] - property:'selected'] expected:<true> but was:<false>
at org.fest.assertions.Fail.fail(Fail.java:87)
at org.fest.assertions.Fail.failIfNotEqual(Fail.java:60)
at org.fest.assertions.BooleanAssert.isEqualTo(BooleanAssert.java:129)
at org.fest.swing.driver.AbstractButtonDriver.assertThatButtonIsSelected(AbstractButtonDriver.java:142)
at org.fest.swing.driver.AbstractButtonDriver.requireSelected(AbstractButtonDriver.java:127)
at org.fest.swing.fixture.JRadioButtonFixture.requireSelected(JRadioButtonFixture.java:288)
A: 

You need to specify how the test fails and maybe show the setUp() method. It could be basically anything with the information you've given.

Jes