Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: FEST-Assert 1.1
-
Fix Version/s: FEST-Swing 1.2a2
-
Component/s: Swing
-
Labels:None
-
Number of attachments :
Description
From Eric Kolotyluk:
OK, The first part of my tests work, but the second part does not. The test code is
@Test public void excerciseAssetTree() { JTreeFixture treeFixture = frameFixture.tree(); // Make sure the colors are in alphabetical order treeFixture.selectPath("Color/Blue"); treeFixture.requireSelection(1); treeFixture.selectPath("Color/Green"); treeFixture.requireSelection(2); treeFixture.selectPath("Color/Red"); treeFixture.requireSelection(3); // Make sure selection works treeFixture.selectRow(1); treeFixture.requireSelection("Color/Blue"); // Fails here treeFixture.selectRow(2); treeFixture.requireSelection("Color/Green"); treeFixture.selectRow(3); treeFixture.requireSelection("Color/Red"); }
As far as I can tell the second set of tests are just the inverse of the first set, so I don't understand why it's failing.
Cheers, Eric
java.lang.AssertionError: [com.kodak.gcg.unified.ui.tree.AssetTree[name=null, selectionCount=1, selectionPaths=['[Root, Color, Blue]'], selectionMode=DISCONTIGUOUS_TREE_SELECTION, enabled=true, visible=true, showing=true] - property:'selection'] array:<[[Root, Color, Blue]]> does not contain element(s):<[[Color, Blue]]>
at org.fest.swing.edt.GuiActionRunner.rethrowCatchedExceptionIn(GuiActionRunner.java:145)
at org.fest.swing.edt.GuiActionRunner.execute(GuiActionRunner.java:97)
at org.fest.swing.driver.JTreeDriver.requireSelection(JTreeDriver.java:505)
at org.fest.swing.driver.JTreeDriver.requireSelection(JTreeDriver.java:499)
at org.fest.swing.fixture.JTreeFixture.requireSelection(JTreeFixture.java:493)
at com.kodak.gcg.unified.ui.tree.AssetTreeFestTest.excerciseAssetTree(AssetTreeFestTest.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
From Jeanette:
Alex,
you can reproduce it with any tree with rootVisible == false.
Problem seems to be that the addRoot-Magic is asymmetric: it happens in selectPath(String) but not in requireSelection(String). The former delegates to JTreeMatchingPathQuery.findVisible which does add the root, the latter to JMPQ.matchingPathFor which doesn't.
BTW, any reason there are two implementations of the addRoot, one implementation in JMPQ, one in JTreeDriver (duplicating the method call in selectPath).