|
23 | 23 | import javafxlibrary.utils.RobotLog; |
24 | 24 | import javafxlibrary.utils.TestFxAdapter; |
25 | 25 | import org.testfx.api.FxRobotInterface; |
| 26 | +import org.testfx.service.query.EmptyNodeQueryException; |
26 | 27 |
|
27 | 28 | import java.util.*; |
28 | 29 |
|
@@ -141,13 +142,21 @@ private Set<Node> findAll(Parent root, int queryIndex) { |
141 | 142 |
|
142 | 143 | private Node executeFind(Parent root, Query query) { |
143 | 144 | RobotLog.debug("Executing find with root: " + root + " and query: " + query.getQuery()); |
144 | | - FindOperation findOperation = new FindOperation(root, query, false); |
145 | | - return (Node) findOperation.executeLookup(); |
| 145 | + try { |
| 146 | + FindOperation findOperation = new FindOperation(root, query, false); |
| 147 | + return (Node) findOperation.executeLookup(); |
| 148 | + } catch (EmptyNodeQueryException e) { |
| 149 | + return null; |
| 150 | + } |
146 | 151 | } |
147 | 152 |
|
148 | 153 | private Set<Node> executeFindAll(Parent root, Query query) { |
149 | 154 | RobotLog.debug("Executing find all with root: " + root + " and query: " + query.getQuery()); |
150 | | - FindOperation findOperation = new FindOperation(root, query, true); |
151 | | - return new LinkedHashSet<>((Set<Node>)findOperation.executeLookup()); |
| 155 | + try { |
| 156 | + FindOperation findOperation = new FindOperation(root, query, true); |
| 157 | + return new LinkedHashSet<>((Set<Node>)findOperation.executeLookup()); |
| 158 | + } catch (EmptyNodeQueryException e) { |
| 159 | + return Collections.emptySet(); |
| 160 | + } |
152 | 161 | } |
153 | 162 | } |
0 commit comments