diff --git a/assertj-swing/src/main/java/org/assertj/swing/core/FinderDelegate.java b/assertj-swing/src/main/java/org/assertj/swing/core/FinderDelegate.java index 5a175f4e..e841b8c0 100644 --- a/assertj-swing/src/main/java/org/assertj/swing/core/FinderDelegate.java +++ b/assertj-swing/src/main/java/org/assertj/swing/core/FinderDelegate.java @@ -36,9 +36,11 @@ final class FinderDelegate { @Nonnull Collection find(@Nonnull ComponentHierarchy h, @Nonnull ComponentMatcher m) { Set found = newLinkedHashSet(); - for (Component c : rootsOf(h)) { - find(h, m, checkNotNull(c), found); - } + execute(() -> { + for (Component c : rootsOf(h)) { + find(h, m, checkNotNull(c), found); + } + }); return found; } @@ -56,13 +58,13 @@ private void find(@Nonnull ComponentHierarchy h, @Nonnull ComponentMatcher m, @N @RunsInEDT @Nonnull private static Collection childrenOfComponent(final @Nonnull Component c, final @Nonnull ComponentHierarchy h) { - Collection children = execute(() -> h.childrenOf(c)); + Collection children = h.childrenOf(c); return checkNotNull(children); } @RunsInEDT private static boolean isMatching(@Nonnull final Component c, @Nonnull final ComponentMatcher m) { - Boolean matching = execute(() -> m.matches(c)); + Boolean matching = m.matches(c); return checkNotNull(matching); } @@ -70,15 +72,17 @@ private static boolean isMatching(@Nonnull final Component c, @Nonnull final Com @Nonnull Collection find(@Nonnull ComponentHierarchy h, @Nonnull GenericTypeMatcher m) { Set found = newLinkedHashSet(); - for (Component c : rootsOf(h)) { - find(h, m, checkNotNull(c), found); - } + execute(() -> { + for (Component c : rootsOf(h)) { + find(h, m, checkNotNull(c), found); + } + }); return found; } @RunsInEDT @Nonnull private static Collection rootsOf(final @Nonnull ComponentHierarchy h) { - return checkNotNull(execute(() -> h.roots())); + return checkNotNull(h.roots()); } @RunsInEDT @@ -95,7 +99,7 @@ private void find(@Nonnull ComponentHierarchy h, @Nonnull @RunsInEDT private static boolean isMatching(final @Nonnull Component c, final @Nonnull GenericTypeMatcher m) { - Boolean matching = execute(() -> m.matches(c)); + Boolean matching = m.matches(c); return checkNotNull(matching); } }