use of org.fest.swing.hierarchy.SingleComponentHierarchy in project ats-framework by Axway.
the class SwingElementFinder method find.
public static <T extends Component> T find(Robot robot, Container root, GenericTypeMatcher<T> m) {
ComponentHierarchy hierarchy = robot.hierarchy();
List<Component> found = null;
if (root == null) {
found = find(hierarchy, m);
} else {
found = find(new SingleComponentHierarchy(root, hierarchy), m);
}
if (found.isEmpty()) {
throw componentNotFound(robot, hierarchy, m);
}
if (found.size() > 1) {
throw multipleComponentsFound(found, m);
}
Component component = found.iterator().next();
return m.supportedType().cast(component);
}
Aggregations